我试图在我的应用程序的数据网格视图中显示 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