I apologize for not knowing the proper terminology. I'm trying to connect to a database, and the tables appear, but there are no entries in them! What did I do wrong?
Dim MyConnection As OleDb.OleDbConnection
Dim MyAdapter As OleDb.OleDbDataAdapter
Dim MyCommand As OleDb.OleDbCommand
Dim StrConn As String
Dim StrSql As String
StrConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= C:\Documents and Settings\STAGINFO\Mes documents\db1.mdb"
MyConnection = New OleDb.OleDbConnection
MyConnection.ConnectionString = StrConn
MyConnection.Open()
StrSql = "SELECT Accessoires.* FROM Accessoires"
MyCommand = New OleDb.OleDbCommand(StrSql)
MyAdapter = New OleDb.OleDbDataAdapter(MyCommand)
MyCommand.Connection() = MyConnection
MyAdapter.Fill(Base, "Acc")
StrSql = "SELECT Emprunteurs.* FROM Emprunteurs"
MyCommand = New OleDb.OleDbCommand(StrSql)
MyAdapter = New OleDb.OleDbDataAdapter(MyCommand)
MyCommand.Connection() = MyConnection
MyAdapter.Fill(Base, "Emp")
StrSql = "SELECT Historiques.* FROM Historiques"
MyCommand = New OleDb.OleDbCommand(StrSql)
MyAdapter = New OleDb.OleDbDataAdapter(MyCommand)
MyCommand.Connection() = MyConnection
MyAdapter.Fill(Base, "His")
StrSql = "SELECT Materiels.* FROM Materiels"
MyCommand = New OleDb.OleDbCommand(StrSql)
MyAdapter = New OleDb.OleDbDataAdapter(MyCommand)
MyCommand.Connection() = MyConnection
MyAdapter.Fill(Base, "Mat")
Me.DataGrid1.DataSource = Base.Tables(0)
Me.DataGrid2.DataSource = Base.Tables(1)
Me.DataGrid3.DataSource = Base.Tables(2)
Me.DataGrid4.DataSource = Base.Tables(3)