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


Top 5 Contributors of the Month
david stephan

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
hi

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...

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

hi,

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   

hi,

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");
con1.Open();
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);
dr.Fill(t);

// dataGridView1.AutoGenerateColumns = true;

this.dataGridView1.DataSource = t;

//this.dataGridView1.DataBind();
// this.dataGridView1.DataMember = "A";

con1.Close();
cmd1.Dispose();
MessageBox.Show("Successfully Completed....", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

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

hi



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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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