• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Filtering a table using input from a textbox using Visual Basic 2005

I have a simple question for you all but seems to be really hanging me up.
On my form I have a textbox that the user will enter a number. I want to use that number to filter a sql table and then display the result in my datagrid.
Here are the columns in the table: IMAGEID; SVID: FILENAME
The query would be something like this: Select *  IMAGEID, SVID, FILENAME FROM IMAGES WHERE SVID = "this would be the input from the user"

0
CR_Office
Asked:
CR_Office
  • 4
  • 3
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
You can do something like:

"SELECT * FROM IMAGES WHERE SVID = '" & Me.TextBox1.Text &"';"
0
 
CR_OfficeAuthor Commented:
That looks great how should it look in my code. I have Button that I call btnSearch to launch the action. Can you give me an example of code (VB2005)?
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Do you already something ?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
CR_OfficeAuthor Commented:
Nothing
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Check this example from Microsoft MSDN

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource.aspx

All you have to do is change you SQLconnection and assing the update of the datagridview to a button click event changing the sql statement as required.
0
 
CR_OfficeAuthor Commented:
Thanks for the example it is just what I needed.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Gald I could help!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now