要从多列搜索记录 [英] ow to search record from multiple column
本文介绍了要从多列搜索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想根据名称,ID,日期,报告类型搜索记录。从同一个表与一个文本框,。任何人都可以给我解决方案。
i可以用一列搜索我想用多列搜索。
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();
}
推荐答案
http://stackoverflow.com/questions/2514548/how-to-search-multiple-columns-in-mysql [ ^ ]
Select * from product where product_id like '%" + TextBox1.Text + "%' or category_id like '%" + TextBox1.Text + "%' or Categoryname like '%" + TextBox1.Text + "%'
这篇关于要从多列搜索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文