DataSet数据绑定问题
string strConnection = "data source=(local);initial catalog=PIMS;user id=sa;password=111";SqlConnection sc = new SqlConnection(strConnection);
adapterContactType = new SqlDataAdapter("select * from ContactsType where users_id='"+user.UsersId+"'", sc);
SqlCommandBuilder builderConatacts = new SqlCommandBuilder(adapterContactType);
DataSet ds = new DataSet();
adapterContactType.Fill(ds);
DataTable tb = ds.Tables[0];
string text=tvContactType.SelectedNode.Text;
foreach (DataRow dr in tb.Rows)
{
if (dr["contactstype_name"].ToString() == text) {
tb.Rows.Remove(dr);
break;
}
} tvContactType.Nodes[0].Nodes.Clear();
adapterContactType.Update(ds);
ds.AcceptChanges();
为什么红色部分不起作用