I'm trying to import all data from an Access DB using Visual Basic 2005. I'm new to Access and so far I can only import one record at a time. Any help would be appreciated!! Here is the code I have so far (obviously to bring one record at a time).
Private Sub BtnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xLoadButton.Click
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
'Connect to Access 2007
con.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0; Data " & "Source = C:\Users\hp\Documents\Database1.accdb"
con.Open()
sql = "SELECT * FROM table1"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Table1")
'The DataSet (ds) will now be filled with the records selected from table
MsgBox("A Connection to the Database is now open")
'close database connection
con.Close()
MsgBox("The Connection to the Database is now Closed")
xPartNumberCombobox.Text = ds.Tables("table1").Rows(0).Item(1)
xPartNameComboBox.Text = ds.Tables("table1").Rows(0).Item(2)
'***************************************************************************
xPartNumberCombobox.Show()
xPartNameComboBox.Show()
xLoadButton.hide()
End Sub