DataView

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语句的模糊查询语句一样
dv.Sort = "au_id DESC";
tst.DataSource=dv;
tst.DataBind();

你可能感兴趣的:(view)