编译错误来自asp.net中的查询字符串

时间:2013-09-07 08:11:51

标签: asp.net string

SqlConnection cn = new SqlConnection("server=localhost;initial catalog=newmits;trusted_connection=true");
cn.Open();

string q = string.Format("SELECT * from upnotice WHERE notice_type LIKE '{0}%'",t);

SqlDataAdapter adp = new SqlDataAdapter(q,cn);
DataSet ds = new DataSet();
adp.Fill(ds);

GridView1.DataSource = ds;
GridView1.DataBind();

错误来自这些行请帮助我

1 个答案:

答案 0 :(得分:0)

试试这个:

string q = "SELECT * from upnotice WHERE notice_type like '%Tender%' OR notice_type like '%RecruitementNotice%'";