首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么用dataGrid读取数据库中数据

2012-09-14 
如何用dataGrid读取数据库中数据如何用dataGrid读取数据库中数据?就是说当查询出数据库某个表的某些列,然

如何用dataGrid读取数据库中数据
如何用dataGrid读取数据库中数据?就是说当查询出数据库某个表的某些列,然后要加载到dataGrid中?求指教!!!

  string CheckId = textBox1.Text.Trim();
  string BoxId = textBox2.Text.Trim();
  string Sql = string.Format("Select GdBarCode,CheckNum from CheckData where CheckId = '{0}' and BoxId = '{1}'",CheckId,BoxId);
  DBAccess.DAL.ExecuteReader(Sql,delegate(IDataReader dr)
  {
  while(dr.Read())
  {
  ???????
  }
  });

[解决办法]
http://showking.blog.hexun.com/626446_d.html
网上链接多的很
[解决办法]
datagridview1.datasource=datatable1;
[解决办法]
datasouce绑定datatable就行了。。

热点排行