首先我想道歉这篇文章的长度。但我希望你了解整个问题。错误信息:找不到表格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