![](/img/trans.png)
[英]Is there an issue binding a result to a DataGridView with combo boxes with NHibernate
[英]Issue with displaying SQL result in DataGridView
我试图在应用程序的数据网格视图中显示SQL查询的结果。 下面的代码是我写的,但是它似乎无关紧要,我无法在窗体的datagridview中显示任何内容。 谁能指出我正确的方向?
码:
Sql = "SELECT * FROM jobList WHERE techID = " & TechScreenID & ""
connection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = C:\Users\Dave\Documents\joblist.mdb;"
con.ConnectionString = connection
con.Open()
Dim adapter As New OleDbDataAdapter(Sql, connection)
Dim results As New DataTable("result")
adapter.Fill(results)
con.Close()
dgwTechStatus.DataSource = results
您需要将datagridview的“ autogeneratecolumns”属性设置为true,或将特定的绑定列添加到datagridview。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.