L
Lucky
OK, spent 5 days searching for info on this one. Seems like it would
be pretty common. Here's the deal:
I have a vb.net windows app that connects to an access database. I'm
using an oleDbDataAdapter, Query Builder, oleDbDataSet,
oleDbDataConnection, and a datagrid. The database has 1 table. One of
the columns is called "Address". A user enters any address into a
textbox (txtValue) then clicks the Find button (cmdFind) and a
datagrid displays all the rows with this address. The problem is that
it will only find the the address if the user types it exactly as it's
entered the the DB. For example: the address column has 123 Anystreet
Rd. If the user types 123 Anystreet then clicks Find, no rows are
returned. But if the user types 123 Anystreet Rd, all rows are
displayed containing that address. I don't want that because the user
won't know exactly how it's stored in the DB. I used an
oleDbDataAdapter and Query builder for my select statement which is:
SELECT *
FROM [Primary Site List]
WHERE (Address LIKE ?)
My cmdFind_click event code is as follows (I'm using option buttons):
If optAddress.Checked = True Then
OleAddressAdapter.SelectCommand.Parameters("Address").Value
= txtValue.Text
DsPrimarySite1.Clear() 'this is my dataset
OleAddressAdapter.Fill(DsPrimarySite1)
End If
How can I get it to return rows containing any portion of the address
entered by the user? The Like command doesn't seem to work in query
builder. How the heck would you search an Access database?
I am a newbie and this is my first app, so please be detailed in your
help. I greatly appreciate any assistance you can provide.
be pretty common. Here's the deal:
I have a vb.net windows app that connects to an access database. I'm
using an oleDbDataAdapter, Query Builder, oleDbDataSet,
oleDbDataConnection, and a datagrid. The database has 1 table. One of
the columns is called "Address". A user enters any address into a
textbox (txtValue) then clicks the Find button (cmdFind) and a
datagrid displays all the rows with this address. The problem is that
it will only find the the address if the user types it exactly as it's
entered the the DB. For example: the address column has 123 Anystreet
Rd. If the user types 123 Anystreet then clicks Find, no rows are
returned. But if the user types 123 Anystreet Rd, all rows are
displayed containing that address. I don't want that because the user
won't know exactly how it's stored in the DB. I used an
oleDbDataAdapter and Query builder for my select statement which is:
SELECT *
FROM [Primary Site List]
WHERE (Address LIKE ?)
My cmdFind_click event code is as follows (I'm using option buttons):
If optAddress.Checked = True Then
OleAddressAdapter.SelectCommand.Parameters("Address").Value
= txtValue.Text
DsPrimarySite1.Clear() 'this is my dataset
OleAddressAdapter.Fill(DsPrimarySite1)
End If
How can I get it to return rows containing any portion of the address
entered by the user? The Like command doesn't seem to work in query
builder. How the heck would you search an Access database?
I am a newbie and this is my first app, so please be detailed in your
help. I greatly appreciate any assistance you can provide.