datagrid问题
怎么在datagrid控件上直接修改添加 全用代码写 怎么完成
数据库的表结构很简单,三个字段:xh,xm,cj
private SqlCommand cmm;
private SqlDataAdapter adp;
private DataSet ds;
private SqlParameter p;
cnn = new SqlConnection("server = .; uid = sa; pwd = sqlpass; database = student");
cmm = new SqlCommand("insert into stu values(@xh,@xm,@cj)",cnn);
adp.InsertCommand = cmm;
p = adp.InsertCommand.Parameters.Add("@xh",null);
p.SourceColumn = "xh";
p = adp.InsertCommand.Parameters.Add("@xm",null);
p.SourceColumn = "xm";
p = adp.InsertCommand.Parameters.Add("@cj",null);
p.SourceColumn = "cj";
adp.Update(ds,"stu");