我在grdview.DataSource = ds.Tables [0]附近发现错误 [英] I Got Error Near the grdview.DataSource = ds.Tables[0]

查看:94
本文介绍了我在grdview.DataSource = ds.Tables [0]附近发现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,我在线路附近遇到错误.

Dear All, I got Error Near the line.


推荐答案



据我所知,查询不返回任何数据,因此数据集ds将不包含表.然后在这种情况下,如果您尝试将ds.Tables [0]分配给gridview,则会抛出错误

尝试如下

Hi,

To my knowledge what I understood is that the query doesnt return any data then the dataset ds will contain no table. Then in that case if you are trying to assign ds.Tables[0] to gridview then it will throw you an error

try as follows

if(ds.Tables.count>0)
{
if(ds.Tables[0]!=null)
{
grdView.DataSource = ds.Tables[0];
grdView.DataBind();
}
}


只需尝试

simply try this

GridView1.DataSource = ds;
GridView1.DataBind();



通过此链接进入
单击



go thru this link
Click


这篇关于我在grdview.DataSource = ds.Tables [0]附近发现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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