VC sql命令的使用

2026年09月10日 02:43
有2个网友回答
网友(1):

SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=;database=pubs);
string sql = "select * from table1 where name like '"+this.txtbox1.text+"'";//按名字模糊查
SqlDataAdapter da= new SqlDataAdapter(sql,con);
DataSet ds = new DataSet();
da.Fill(ds,"table1");
DataView dv= new DataView(ds.Tables["talbe1"]);
this.datagrid1.DataSource = dv;
this.datagrid1.DataBind();
貌似写在Button1按扭里就行了

网友(2):

SQL:

SELECT * FROM TABLE1 T WHERE T.字段名 LIKE '%"+this.txtbox1.text+"%';