Click here to Skip to main content
Sign Up to vote bad
good
I want to search record based on Name, ID, Date, Report Type. from same table with one textbox,. can any one give me solution,.
 
i can do search with one column i want to search with multiple column .
 

protected void Button2_Click(object sender, EventArgs e)
    {
       
     DateTime dt = Convert.ToDateTime(TextBox1.Text);
     SqlCommand cmd = new SqlCommand("SELECT * FROM Transactions where report_type = @report_type ");
 
     cmd.Connection = con;
     cmd.Parameters.Add("@report_type", SqlDbType.NVarChar).Value = DropDownList1.SelectedValue;
     SqlDataAdapter da = new SqlDataAdapter(cmd);
     DataSet ds = new DataSet();
     da.Fill(ds);
     GridView1.DataSource = ds;
      GridView1.DataBind();
    }
Posted 8 Dec '12 - 0:30


2 solutions

 
Select * from product where product_id like '%" + TextBox1.Text + "%' or  category_id like '%" + TextBox1.Text + "%' or Categoryname like '%" + TextBox1.Text + "%'
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 178
1 Tadit Dash 144
2 Santhosh G_ 140
3 Sergey Alexandrovich Kryukov 134
4 Espen Harlinn 120
0 Sergey Alexandrovich Kryukov 10,348
1 OriginalGriff 7,965
2 CPallini 4,241
3 Rohan Leuva 3,522
4 Maciej Los 3,184


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 8 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid