Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 .


C#
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

SQL
Select * from product where product_id like '%" + TextBox1.Text + "%' or  category_id like '%" + TextBox1.Text + "%' or Categoryname like '%" + TextBox1.Text + "%'
 
Share this answer
 
v3

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