A
ai1231
Guest
Hi!
I am trying to get data for different columns in different tables but this code give me an error
I tried using union select too but I don't know how to get the result devided with executereader
SELECT Pas_ID FROM ABR UNION SELECT Nr_dok FROM C ORDER BY Pas_ID;
But I get all results mixed together
What I want is get on listbox1 column1,column2 of table1 and on listbox2 column1,column2 of table2
Dim cmdString As String = "SELECT Pas_ID FROM ABR;SELECT Nr_dok FROM C;"
Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\test.mdb;Jet OLEDB
atabase Password=;Mode=Share Deny Read|Share Deny Write;"
Dim myConnection As OleDbConnection = New OleDbConnection(connString)
myConnection.Open()
Dim TheCommand As OleDbCommand = New OleDbCommand(cmdString, myConnection) With {
.CommandType = CommandType.Text
}
Dim TheDataReader As OleDbDataReader = TheCommand.ExecuteReader()
While TheDataReader.Read()
ListBox1.Items.Add(TheDataReader.GetString(0))
End While
If TheDataReader.NextResult() Then
While TheDataReader.Read()
ListBox2.Items.Add(TheDataReader.GetString(0))
End While
End If
Continue reading...
I am trying to get data for different columns in different tables but this code give me an error
I tried using union select too but I don't know how to get the result devided with executereader
SELECT Pas_ID FROM ABR UNION SELECT Nr_dok FROM C ORDER BY Pas_ID;
But I get all results mixed together
What I want is get on listbox1 column1,column2 of table1 and on listbox2 column1,column2 of table2
Dim cmdString As String = "SELECT Pas_ID FROM ABR;SELECT Nr_dok FROM C;"
Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\test.mdb;Jet OLEDB

Dim myConnection As OleDbConnection = New OleDbConnection(connString)
myConnection.Open()
Dim TheCommand As OleDbCommand = New OleDbCommand(cmdString, myConnection) With {
.CommandType = CommandType.Text
}
Dim TheDataReader As OleDbDataReader = TheCommand.ExecuteReader()
While TheDataReader.Read()
ListBox1.Items.Add(TheDataReader.GetString(0))
End While
If TheDataReader.NextResult() Then
While TheDataReader.Read()
ListBox2.Items.Add(TheDataReader.GetString(0))
End While
End If
Continue reading...