|
-
Feb 2nd, 2013, 05:23 PM
#10
Thread Starter
Lively Member
Re: Filtering data in grid view.
Solved my previous question like so:
Dim County, SQLString As String
Dim Bedrooms As String
Dim NonSmoking 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"
County = lstCounties.Text
Bedrooms = lstCounties.Text
NonSmoking = txtboxSmoking.Text
SQLString = "SELECT * FROM Properties WHERE County Like '%" & County & "%' and Bedrooms LIKE '%" & Bedrooms & "%' and NonSmoking LIKE '%" & NonSmoking & "%'"
dbDataAdapter = New OleDbDataAdapter(SQLString, ConnectString)
dbDataAdapter.Fill(dtProperties)
grdProperties.DataSource = dtProperties
How can I use SQL Between command in vb? I try to make a query that can filter places that have for example 2-4 bedrooms.
Amount1 = txtboxBedroomamount1.Text()
Amount2 = txtboxBedroomamount2.Text()
SQLString = "SELECT * FROM Properties WHERE Bedrooms between = '" & Amount1 & "' AND '" & Amount2 & "'"
This query doesn't seem to work....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|