.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

multiple textbox search on datagridview in windows application

Posted By: Jayakumar     Posted Date: March 04, 2010    Points:2   Category :Windows Application

thank for reply..

i am working on windows application(3.5,c#).
i have 4 textbox's.
i have an datagridview.

the result with datagridview shud vary and depends the values typed on the txtboxes

if type value on txtbox1 then i shud get one set of result,
if type value on txtbox2 then i shud get another set of result,

how it can be done...

Author: Faizal             
Posted Date: March 04, 2010     Points: 5   


Do you want to build Dynamic search sql query based on the user input in the textbox?

Author: Jayakumar             
Posted Date: March 05, 2010     Points: 5   


yes. and one more thing

how to prevent autogenerate columns in datagridview(i have used "this.dgc.autogeneratecolumn=false")
but its not working.
this is the code i am using buttonclick event.

SqlConnection con1 = new SqlConnection("Data Source=HOME\\SQLEXPRESS;Initial Catalog=AB;Persist Security Info=True;User ID=sa;Password=sa");
String sql1 = "Select SongId,SongTitle,FilmTitle from A where Actor= '" + textBox1.Text + "' ";
SqlCommand cmd1 = new SqlCommand(sql1, con1);
DataTable t = new DataTable();
SqlDataAdapter dr = new SqlDataAdapter(cmd1);

// dataGridView1.AutoGenerateColumns = true;

this.dataGridView1.DataSource = t;

// this.dataGridView1.DataMember = "A";

MessageBox.Show("Successfully Completed....", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

Author: Jayakumar             
Posted Date: March 05, 2010     Points: 5   


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend