找不到表0错误 [英] Cannot find table 0 error

查看:101
本文介绍了找不到表0错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码是通过文本框值搜索gridview。相同的代码在其他形式下工作正常。但目前的形式并不起作用。请帮忙。

P.S: - 我的sp工作正常。我查了一下

Thnx .. :)



我尝试了什么:



The below piece of code is for search gridview via textbox value.the same code works fine in other form. but doesnt work in current form. please help.
P.S:- My sp works fine. i checked it
Thnx.. :)

What I have tried:

protected void btnsearch_Click(object sender, System.EventArgs e)
        {
            lblWarningMessage.Text = "";
            try
            {
                if (!string.IsNullOrEmpty(txtSearch.Text))
                {
                    GVEquipmentAttribute.Visible = true;
                    DataSet dsSite = new DataSet();
                    ArrayList arrparam1 = new ArrayList();
                    arrparam1.Add(txtSearch.Text.Trim());
                    dsSite = objDB.ExecProc_getDataSet("D_SP_GET_EquipmentAttribute_GRID_Search", arrparam1);
                    DataTable dt = new DataTable();
                    if (dsSite.Tables[0].Rows.Count > 0)
                    {
                        //btnDelete.Visible = True
                    }
                    else
                    {
                        //btnDelete.Visible = False
                    }
                    dt = dsSite.Tables[0];

                    GVEquipmentAttribute.DataSource = dt;
                    GVEquipmentAttribute.DataBind();
                }
                else
                {
                    BindGrid();
                }

推荐答案

将其修改为



Modify it as

DataTable dt = new DataTable();
          dsSite = objDB.ExecProc_getDataSet("D_SP_GET_EquipmentAttribute_GRID_Search", arrparam1);
          if (dsSite != null && dsSite.Tables.Count > 0)
          {
              dt = dsSite.Tables[0];

              if (dt.Rows.Count > 0)
              {
                  //btnDelete.Visible = True
              }
              else
              {
                  //btnDelete.Visible = False
              }
          }


          GVEquipmentAttribute.DataSource = dt;
          GVEquipmentAttribute.DataBind();


这篇关于找不到表0错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆