954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem with sql on dataset

hi

i am just starting with vb.net and have set a connection to an existing access db that i have and am able to get the data displayed on a form.

my problem lies where as i want to setup a basic search. i have added a query to a datagrid to dispaly data based on text in a text box.

now my sql query is this:

SELECT CustID, CustName, CustAddress, CustPostcode, CustTel, CustEmail, CustNotes, CustRoom, CustStayArrive, CustStayLeave
FROM tblCustData
WHERE CustName = '"& SearchBox.text &"'


now i get no errors but also no data gets returned. If i add the actual value of one of the records that one gets returned fine but doesnt really help with a search.

wondered if anyone had any ideas?

regards

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

Hello

Try This

SELECT CustID, CustName, CustAddress, CustPostcode, CustTel, CustEmail, CustNotes, CustRoom, CustStayArrive, CustStayLeave
FROM tblCustData
WHERE CustName Like '" & SearchBox.text & "%'


Faisalhi

i am just starting with vb.net and have set a connection to an existing access db that i have and am able to get the data displayed on a form.

my problem lies where as i want to setup a basic search. i have added a query to a datagrid to dispaly data based on text in a text box.

now my sql query is this:

SELECT CustID, CustName, CustAddress, CustPostcode, CustTel, CustEmail, CustNotes, CustRoom, CustStayArrive, CustStayLeave
FROM tblCustData
WHERE CustName = '"& SearchBox.text &"'


now i get no errors but also no data gets returned. If i add the actual value of one of the records that one gets returned fine but doesnt really help with a search.

wondered if anyone had any ideas?

regards

mafaisal
Newbie Poster
11 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

hi

made the change, no error but still not returing anything. Please note that this sql query is being done via the 'Query Configuration Wizard'

im not sure wether i should be doing the query somewhere else, and if so how do i reference the connection?

ninjaimp
Junior Poster
130 posts since Apr 2008
Reputation Points: 22
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You