VB.net Query record by user's input?

Arabo

New member
Suppose that I have a form.
a button
Inside the form, I have 1 textbox named userquery
I also have datagrid View name dgrid

I am using MS SQL Server 2005
With a table named "classmates"
these are the fields:
id
fname
lname
addres

Now, what I want is that when the program runs,
I just only input the Lastname of my classmate and click the button
after that, it will display my classmates in the datagrid view who has a lastname that is matched to the lastname I'have entered in the textbox.

Please help how I am going to do this.
To connect to database, I am using Data-Add New Data Source-... and finally, it will create a dataset
I have now the dataset of the table in my Data Sources
The query generated by the wizard is:
SELECT * FROM classmates

I know that I should put WHERE clause.
My question is how can I get the value of the textbox?

Please I need your help.

I need to use data wizard because it is required. If I am going to make it using
hardcoding approach, I can make it.
Please help me. and No Hardcoding please. just the wizard.
 
Back
Top