Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 11-Jul-19 8:03am
Comments
MadMyche 11-Jul-19 13:06pm    
So where are you stuck; the database query, or the Net code to call it?
Richard MacCutchan 11-Jul-19 13:24pm    
There are many articles around which will show you how to do it. Google for "datagridview" and you will find them.

1 solution

Something like this:
C#
using (SqlConnection con = new SqlConnection(strConnect))
                {
                con.Open();
                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();
                    da.Fill(dt);
                    myDataGridView.DataSource = dt;
                    }
                }
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900