1

i have a table adapter called Tabone and i want to create a query a column where i can retrieve values that are like or contains some character or prefix from the query string .

for example : if i write in a textbox 20 it retrieves all records which contains 20 whether in the beginning or middle or end and each time i add more character it filters more records.

i thought of using textbox_textchanged event

my sql query was :
select [ID] [Name] [description] from [Tabone] where [Name] like ?

but it does not do the job

5
  • And I suggest that you fetch all the data to a data table.Then under the text changed event, you can do the filter from the data table. Commented Feb 2, 2019 at 17:55
  • Let me straighten out a bit of the semantics. The table in your database is called Tabone; your TableAdapter name is TaboneTableAdapter. I am not familiar with TableAdapters but you can pull a DataTable out of one with the .GetData method. Then you can use the .Select(string) method on the resulting DataTable to get the rows your are interested in. No need to hit the database again. Commented Feb 2, 2019 at 18:46
  • @Mary i'm displaying the result in a datagridview with a bindingsource. Commented Feb 3, 2019 at 6:59
  • stackoverflow.com/q/251276/5045688 Commented Feb 3, 2019 at 13:59
  • 1
    Try this like '%" & textbox1.Text & "%'" Commented Feb 4, 2019 at 13:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.