Question Searching Problem

nokia123

Active member
Joined
May 1, 2011
Messages
29
Programming Experience
Beginner
how can i search in the database for particular string in the column. and if string is found in that column ,if pulls the data onto the form. and if not , it shows a message "not found".

i am doing it with bindingsource.filter but things are not fine with it..

Any suggestion please
 
You're going to have to provide a clearer explanation of the issue. First, you're not searching the database using BindingSource.Filter. Second, BindingSource.Filter is not for finding a record. It's for displaying a subset of records that you've already retrieved. If you provide a FULL and CLEAR explanation then we can provide a solution. Otherwise, we're really just guessing.
 
Okey. I am using Ms-Access 2007 as my database with vb2008 as front end. On the form i have datagrid ,and in that datagrid ,there is a column named "Name". there are 100 names in that column. And I have put a textbox on the form to search any name on finding that particular name,the associated data will display on another form.
I want to program it in such a way that if the look up name does not match in that column, the message popped up a "Name Not in Database".
Kindly Suggest me regarding this.. hoping that this time I mentioned my problem accordingly.

Regards,
 
So this question has nothing to do with searching in a database. You already have all the data from the database so the database part is done. If you are indeed using BindingSource.Filter to filter the data then what are the possible outcomes? Either there are some matching rows or there aren't. What property or method of the BindingSource tells you whether it's exposing any items?

If you really do want to search, rather than filter, then you would use the Find method of the BindingSource. It will return the index of the first matching row, which you can then use to get that row from the BindingSource. This is still not searching the database. It's searching the data bound to the BindingSource.
 
If i am filtering using BindingSource then it is only showing the data if the string is matched and if it does not ,then it shows the form but every thing is blank on that form.
How can i do it with Find method?
 
Back
Top