关于DataTable的,高手来帮帮忙
AccountInfoBLL bll = new AccountInfoBLL(); DataTable dt= bll.GetAccountById(id); DataTable sdt = bll.BindStageDropDownList(); for (int i = 0; i < sdt.Rows.Count; i++) { }AccountInfoBLL bll = new AccountInfoBLL(); DataTable dt= bll.GetAccountById(id); DataTable sdt = bll.BindStageDropDownList(); for (int i = 0; i < sdt.Rows.Count; i++) { for(int j = 0; j < sdt.Rows.Count; j++) if(dt.Rows[i]["Type"].ToString()==sdt.Rows[i]["Type"]) }
[解决办法]
for (int i = 0; i < sdt.Rows.Count; i++) { for (int j = 0; j < dt.Rows.Count; j++) { //这里比较吧,比如 if (dt.Rows[j].Cells[0].Value.ToString() == sdt.Rows[i].Cells[0].Value.ToString()) { //选中 } } }