Click here to Skip to main content
14,236,142 members
Rate this:
Please Sign up or sign in to vote.
hello, i just need to search in database with some numbers like 1231241 and want that that application show every row for that,
its like i want to implement select * from extinv where IRRN = 1231241 and want to see that rows in windows forms how to do it? thanks

What I have tried:

i didnt find anything how to do it
Updated 4 days ago
MadMyche 4 days ago
So where are you stuck; the database query, or the Net code to call it?
Richard MacCutchan 4 days ago
There are many articles around which will show you how to do it. Google for "datagridview" and you will find them.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Something like this:
using (SqlConnection con = new SqlConnection(strConnect))
                using (SqlDataAdapter da = new SqlDataAdapter("SELECT MyColumn1, MyColumn2 FROM myTable WHERE mySearchColumn = @SEARCH", con))
                    da.SelectCommand.Parameters.AddWithValue("@SEARCH", myTextBox.Text);
                    DataTable dt = new DataTable();
                    myDataGridView.DataSource = dt;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100