I am trying to show the results of a SQL query within a data grid view on my application. The following code is what i have written but it dosent seem to matter what i do, i cannot get any display in the datagridview on my form. Can anyone point me in the right direction?
code:
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
You need to set the datagridview’s “autogeneratecolumns” property to true, or add specific bound columns to your datagridview.