New to VB.Net and trying to read two tables from the same database into the same Dataset object. I've included a small section of the code below which is not working (it's failing on the first Session statement). The Visual Studio debugger says that the field "Entry Education Level" is not in the table; however, there is no doublt that it is. I've checked the database for spelling errors and the table is there. Also, with the debugging window available, I can see that the Dataset object appears to be confused because when it reports on the number of fields (columns) in this table (Client Education) it says 29 which is actually the number of fields in the Clients table. I'm sure I'm not correctly initializing some variables. Any help greatly appreciated.
Dim connection As New Data.OleDb.OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;" & _
Dim SelectString As String
SelectString = "select * from Clients where [First Name] = '1' and [Last Name] = '2'"
Dim SelectCommand As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand(SelectString)
Dim Adapter As New Data.OleDb.OleDbDataAdapter()
Dim Dataset1 As New Data.DataSet()
Adapter.SelectCommand = SelectCommand
SelectCommand.CommandType = Data.CommandType.Text
SelectCommand.Connection = connection
SelectString = "select * from [Client Education] where ClientID = '377'"
Adapter.Fill(Dataset1, "Client Education")
If (Dataset1.Tables("Client Education").Rows.Count <> 0) Then
Session("Education") = Dataset1.Tables("Client Education").Rows(0).Item("Entry Education Level")
Session("Highgrade") = Dataset1.Tables("Client Education").Rows(0).Item("Highest Grade Completed")
Session("College") = Dataset1.Tables("Client Education").Rows(0).Item("Current College")
Session("Pasteducation") = Dataset1.Tables("Client Education").Rows(0).Item("Past Education Activity")