如何将数据源连接到数据网格视图

如何将数据源连接到数据网格视图

问题描述:

我有一个数据库在ms访问名称帐户中有三个表名称userid,mydata&booking我想通过编程数据集添加数据源到datagridveiw填充我的一个表名userid只有一个列用户名我怎么能这样做我知道我如何通过属性更改而不是通过代码来帮助我

i have one database in ms access name account with three tables name userid,mydata & booking i want to add data source to datagridveiw by programming dataset filling with my one table name userid only one column username how can i do this i know how can i do this by property change but not by codes help me out

检查这个 [ ^ ] out


试试这个代码..



try this code..

DataTable dt1 = new DataTable();
SqlDataAdapter ad1 = new SqlDataAdapter("select statement", sql_con);
ad1.Fill(dt1);
dgrid_kot_entry.DataSource=dt1;





如果此代码对您没有帮助,请评论是什么问题?

i will试着解决问题!!!



if this code not helps you, please comment what is the problem ?
i will try to to solve the problem !!!