任何人都可以解决在gridview中填充数据的问题 [英] can anyone correct at issue of filling the data in gridview

查看:97
本文介绍了任何人都可以解决在gridview中填充数据的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个查询.


i wrote a query as.


SqlDataAdapter da = new SqlDataAdapter("select users.username,groups.name from users,groups inner join users on roles.userid=users.userid inner join groups on roles.groupid=users.groupid", MAconn); 
but i am getting an error
 

System.NullReferenceException: Object reference not set to an instance of an object. at Default2.bind()

推荐答案

假定所有表都具有查询中引用的列,并且ID具有其名称所隐含的含义,认为这应该是一个有效的查询.
Assuming that all tables have the columns referenced in your query, and IDs have the meaning implied by their names, I think this should be a working query.
select users.username, groups.name
from users
inner join roles on roles.userid=users.userid
inner join groups on roles.groupid=groups.groupid


如果遇到异常,是否可以从堆栈跟踪中发布更多行?


If you get an exception, could you post more lines from the stack trace?


如何设置MAconn?您忘了新建吗?
How did you setup MAconn? Did you forget to New it?


这篇关于任何人都可以解决在gridview中填充数据的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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