
Originally Posted by
Shaggy Hiker
I think that for Access it would be something like this:
WHERE OEM = -1 AND AUDI = -1
but I may have the wrong representation for True.
Thank you, it did it. Something new to learn.
Another quick question. How can I modify this code to close database connection and does it refresh the data(in the gridview) when the code has launched again?
Code:
Private Sub lstBedrooms_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstBedrooms.SelectedIndexChanged
Dim Bedrooms, SQLString As String
Dim dtProperties As New DataTable()
Dim dbDataAdapter As OleDbDataAdapter
Dim ConnectString As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source = Holidays.mdb"
Bedrooms = lstBedrooms.Text
SQLString = "SELECT * FROM Properties WHERE Bedrooms = " & Bedrooms & ""
dbDataAdapter = New OleDbDataAdapter(SQLString, ConnectString)
dbDataAdapter.Fill(dtProperties)
grdProperties.DataSource = dtProperties
End Sub