G
Guest
What is the correct syntax for passing a select statement via the Reader.
The following code doesn't return anything.
Dim strSQL2 As String = "SELECT * from ATable WHERE ' " &
ComboBox1.Text & " ' = ' " & TextBox1.Text & " '"
Dim cmd As New OleDbCommand(strSQL2, Conn)
Dim rdr As OleDbDataReader
rdr = cmd.ExecuteReader
ListBox1.Items.Clear()
ListBox1.Items.Add("")
While rdr.Read
ListBox1.Items.Add(rdr("Col_One") & " " & rdr("Col_Two") &
" " & rdr("Col_Three") & " " & rdr("Col_Four"))
End While
rdr.Close()
Thanks
The following code doesn't return anything.
Dim strSQL2 As String = "SELECT * from ATable WHERE ' " &
ComboBox1.Text & " ' = ' " & TextBox1.Text & " '"
Dim cmd As New OleDbCommand(strSQL2, Conn)
Dim rdr As OleDbDataReader
rdr = cmd.ExecuteReader
ListBox1.Items.Clear()
ListBox1.Items.Add("")
While rdr.Read
ListBox1.Items.Add(rdr("Col_One") & " " & rdr("Col_Two") &
" " & rdr("Col_Three") & " " & rdr("Col_Four"))
End While
rdr.Close()
Thanks