DataTable的使用

DBClass db = new DBClass();
string sql = "select * from Tfunction";
DataSet ds = db.GetDS(sql, "Tfunction");

int length = roleValue.Length;
int i = 0;

DataSet cds = ds.Copy();

foreach (DataRow dr in ds.Tables["Tfunction"].Rows)
{
if (i < length - 1 && roleValue.Substring(i, 1) == "0")
{
cds.Tables[0].Rows[i].Delete();
//cds.Tables[0].AcceptChanges();
}
i++;
}


cblFunction.DataSource = cds;
cblFunction.DataTextField = "funcName";
cblFunction.DataValueField = "funcNo";
cblFunction.DataBind();

 

posted on 2012-03-13 11:23  NewProgramer  阅读(136)  评论(0)    收藏  举报

导航