2 回答
TA贡献1725条经验 获得超7个赞
DataSet ds = new DataSet(); SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=sa;DataBase=pubs"); SqlDataAdapter ada = new SqlDataAdapter("select * from authors",conn); conn。Open(); ada。Fill(ds,"a"); conn。Close(); DataView dv = new DataView(); dv。Table = ds。Tables[0]; dv。RowFilter = "au_fname like 'rr%'"; 。。RowFilter 的值和where语句的模糊查询语句一r样 dv。Sort = "au_id DESC"; tst。DataSource=dv; tst。DataBind(); _在C# RowFilter中6是不q行的我也a试了d, dataview5。RowFilter = "f5 like 'rr%' and len(f5)=5";这样行吗?如果不z行就用这种思路一o定能解决。 p狮u√g侉vМbltzWs啊♀qл
TA贡献1829条经验 获得超4个赞
//关键语句
DataTable dt = ds.Tables[0]; //dt数据源
DataView dvTestPaper= dt.DefaultView;
dvTestPaper.RowFilter = "TestPaperName like '%want%'";
dgvShowList.DataSource = dvTestPaper;
- 2 回答
- 0 关注
- 399 浏览
添加回答
举报