您的位置:首页 > 其它

实现WINFORM模糊查询

2007-05-25 17:07 239 查看
conn=new SqlConnection("workstation id=ZERG1;packet size=4096;integrated security=SSPI;data source=ZERG1;persist security info=False;initial catalog=Northwind");
string sql="select * from biyesheji where changshang like '%"+textBox1.Text+"%' or wpid like '%"+textBox1.Text+"%' or wpiming like '%"+textBox1.Text+"%' or guige like '%"+textBox1.Text+"%'";
cmd=new SqlCommand(sql,conn);
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds,"biyesheji");
dataGrid1.DataSource=ds;
dataGrid1.DataMember="biyesheji";
conn.Close();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: