Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 错误消息:找不到表0_C#_Stored Procedures_Dataset - Fatal编程技术网

C# 错误消息:找不到表0

C# 错误消息:找不到表0,c#,stored-procedures,dataset,C#,Stored Procedures,Dataset,首先,我想为这篇文章的篇幅道歉。但我想让你了解整个问题 我必须合并三个数据集dsGetForm、dsmedication_details和dsbroadband_details,并在表格中显示结果 有时DSU详细信息包含行,有时不包含行 这就是我现在用来合并数据集的方法 if (dsGetForm != null && dsmedication_details != null && dsbroadband_details != null) { dsGetFo

首先,我想为这篇文章的篇幅道歉。但我想让你了解整个问题

我必须合并三个数据集dsGetForm、dsmedication_details和dsbroadband_details,并在表格中显示结果

有时DSU详细信息包含行,有时不包含行

这就是我现在用来合并数据集的方法

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;
} 
问题是,当存储过程的结果为空时,用于填充数据集DSU详细信息的存储过程SP会向我发送此错误消息

错误消息:找不到表0。 描述:未处理的异常 在执行过程中发生 当前web请求。请检查 堆栈跟踪以获取更多信息 关于错误以及错误发生的位置 源于代码

例外情况详情: System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail, System.ServiceModel,版本=3.0.0.0, 文化=中立, PublicKeyToken=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 app_id=@appid 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
我想,我需要在if@PIName条件之后添加一个else条件

我的问题是,其他条件应该是什么

因为我只需要if@PIName末尾的select语句的值 当这个条件为真时,我有点困惑,那应该是什么


非常感谢您的帮助。

在我看来,有些情况下您的SP不会返回任何结果,因此没有表0。我宁愿构造一个@results内存表,在该表中插入数据(如果有的话),并最终选择mem_name、app_id。。。退出SP之前从@results。或任何其他实际返回结果集(甚至为空)的SQL构造。

在我看来,有些情况下SP不返回任何结果,因此没有表0。我宁愿构造一个@results内存表,在该表中插入数据(如果有的话),并最终选择mem_name、app_id。。。退出SP之前从@results或任何其他实际返回结果集(甚至为空)的SQL构造。

如何填充数据集?我认为问题出在您的代码中,您还需要检查此dsGetForm.Tables[0]!=null或dsGetForm.Tables.Count>0表示每个数据集显示是否填充数据集?我认为问题出在您的代码中,您还需要检查此dsGetForm.Tables[0]!=对于每个数据集,null或dsGetForm.Tables.Count>0