I have a program where theres is a microsoft access 2003 database file and i want to pull up a query and display it in text boxes, i tried putting in the query name but it has an error, it works fine when i put a table as the data source but i need a query
code :
VB Code:
Private Sub Allocated_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Get data from the database, put it into the DataTable object dt, 'and display the initial record's data in text boxes Dim connStr As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & _ "Data Source = EngineerJobs.mdb" Dim sqlStr As String = "SELECT * FROM Engineers_on_Jobs" Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr) dataAdapter.Fill(dt) dataAdapter.Dispose() UpdateTextBoxes() End Sub
many thanks





Reply With Quote