ASP.NET如何做个简单的模糊查询并显示结果?
1个回答
2013-07-19
展开全部
string strConn="server=192.168.1.103;database=111;uid=sa;pwd=";
SqlConnection myConn=new SqlConnection(strConn);
string strSql;
strSql = "select * from 出库表 WHERE (序号 like '%"+this.TextBox1.Text.Trim() +"%')";
SqlCommand forumCommand =new SqlCommand(strSql,myConn);
sqlDataAdapter1=new SqlDataAdapter();
DataSet1 dataSet11= new DataSet1();
sqlDataAdapter1.SelectCommand =forumCommand;
sqlDataAdapter1.Fill(dataSet11,"出库表");
DataGrid1.DataSource=dataSet11;
DataGrid1.DataBind();
SqlConnection myConn=new SqlConnection(strConn);
string strSql;
strSql = "select * from 出库表 WHERE (序号 like '%"+this.TextBox1.Text.Trim() +"%')";
SqlCommand forumCommand =new SqlCommand(strSql,myConn);
sqlDataAdapter1=new SqlDataAdapter();
DataSet1 dataSet11= new DataSet1();
sqlDataAdapter1.SelectCommand =forumCommand;
sqlDataAdapter1.Fill(dataSet11,"出库表");
DataGrid1.DataSource=dataSet11;
DataGrid1.DataBind();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询