dataModel sqlinfo = new dataModel();
private SqlConnection conn;
private SqlDataAdapter rs;
private DataSet myDataSet;
private BindingManagerBase myBind;
private string sql=null;
conn = sqlinfo.ReturnConn();
if (conn != null)
{
conn = sqlinfo.ReturnConn();
}
else
{
conn.Close();
}
string sql = "select M_bh,M_zh from [manageinfo]";
myDataSet = new DataSet();
rs = new SqlDataAdapter(sql, conn);
rs.Fill(myDataSet, "manageinfo");
myBind = this.BindingContext[myDataSet, "manageinfo"];
//Add
DataRow dr=MyDataSet.Tables["UserList"].NewRow();
dr["UserName"] = "周讯";
dr["ReMark"] = "100";
dr["Comment"] = "漂亮MM";
MyDataSet.Tables.Rows.Add(dr);
//Edit
MyDataSet.Tables["UserList"].Rows[0]["UserName"]="飞刀大哥";
//Dele
MyDataSet.Tables["UserList"],Rows[0].Delete();
//back
if(MyDataSet.HasErrors)
{
MyDataSet.RejectChanges();
}
//Update
MyComm.Update(MyDataSet,"UserList");