首先我想道歉這篇文章的長度。但我希望你瞭解整個問題。錯誤信息:找不到表格0
我必須合併三個數據集(dsGetForm
,dsmedication_details
和),並在一個表中顯示結果。
有時包含行,有時它不。
這就是我現在用來合併數據集。
if (dsGetForm != null && dsmedication_details != null && dsbroadband_details != null)
{
dsGetForm.Tables[0].Merge(dsmedication_details.Tables[0]);
dsGetForm.Tables[0].Merge(dsbroadband_details.Tables[0]);
}
else if (dsGetForm == null && dsmedication_details != null)
{
dsGetForm = dsmedication_details;
}
else if (dsGetForm == null && dsbroadband_details != null)
{
dsGetForm = dsbroadband_details;
}
的問題是,它是用來填充DataSet是給我這個錯誤消息,當存儲過程的結果爲空
錯誤信息存儲過程(SP):不能找到表0. 描述:在執行 當前Web請求期間發生未處理的異常 。請查看 堆棧跟蹤以瞭解更多信息 關於錯誤以及它在代碼中產生的位置 。
異常詳細信息: System.ServiceModel.FaultException`1 [System.ServiceModel.ExceptionDetail, System.ServiceModel,版本= 3.0.0.0, 文化=中立, 公鑰= b77a5c561934e089]]: 找不到表0
這是我的存儲過程
Alter Procedure dbo.OEA_SP_GET_BROADBAND (
@appid NUMERIC,
@clientid NUMERIC,
@Lang Varchar(10))
AS
SET nocount ON
BEGIN
declare @PIName as varchar(100)
declare @username as varchar(20)
declare @pform_id as varchar(20)
declare @pform_desc as varchar(100)
declare @userid varchar(20)
declare @msn tinyint
set @PIName=''
if exists(SELECT app_id from ext_well_new_programs (nolock) where [email protected] and new_prog_id='BB' and status='A')
begin
select @PIName=dbo.oea_fn_fetch_fullname(@appid,primary_msn,1,@lang,@clientID)
from app_application with (nolock)
where app_id = @appid
end
if @PIName <> ''
begin
select Distinct @username = dbo.oea_fn_fetch_caaname(prog.last_update_id, 30000)
from app_prog_submission prog (nolock)
where app_id = @appid
select @userid = user_id, @msn = primary_msn
from app_application (nolock)
where app_id = @appid
set @pform_id = 'learnmore'
set @pform_desc = 'Cash Back for Broadband at Home'
select @PIName as mem_name, @appid as app_id, @username as username, @pform_id as pform_id, @pform_desc as pform_desc, 0 as noncust, @userid as userid, @msn as msn
END
End
我想,我需要後添加else
條件條件。
我的問題是其他條件應該是什麼?
因爲我只需要if @PIName <> ''
條件的select語句的值(最後),當這個條件成立時,我有點困惑,應該是什麼?
任何幫助,非常感謝。
你如何填寫你的數據集?我認爲問題出在你的代碼中,你需要爲每個數據集檢查這個dsGetForm.Tables [0]!= null或者dsGetForm.Tables.Count> 0 – 2011-06-14 16:04:58