大虾们进,帮帮菜鸟ing...
请问怎样把ds比较后的结果绑定到DataGrid上去?if里面做的比较,把符合条件的绑定到DataGrid
conn = DB.DB_SqlAccess.getconn();
conn.Open();
da = new SqlDataAdapter(SqlCreateCreate, conn);
DataSet ds = new DataSet();
da.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (Convert.ToInt32(ds.Tables[0].Rows[i][2]) > Convert.ToInt32(this.text2.Value))
{
请问怎么绑定?
}
}
------解决方案--------------------DataView oView = new DataView();
oView.Table = ds.Table[0];
oView.RowFilter = "City > ' " +this.text2.Value+ " ' ";
DataGrid1.DataSource = oView;
DataGrid1.DataBind();