string id = GV_kh.DataKeys[e.RowIndex].Value.ToString();
string mingcheng = ((TextBox)(GV_kh.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
string dianhua = ((TextBox)(GV_kh.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
string dizhi = ((TextBox)(GV_kh.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
string youbian = ((TextBox)(GV_kh.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();
string sql = "update JB_khxx set mingcheng=@mingcheng,dianhua=@dianhua,dizhi=@dizhi,youbian=@youbian where id=@id";
DbConnection dc = new DbConnection();
OleDbConnection mycon = new OleDbConnection(dc.ConnectionString);
OleDbCommand mycom = new OleDbCommand(sql, mycon);
mycom.Parameters.Add("@id", System.Data.OleDb.OleDbType.VarChar);
mycom.Parameters.Add("@mingcheng", System.Data.OleDb.OleDbType.VarChar);
mycom.Parameters.Add("@dianhua", System.Data.OleDb.OleDbType.VarChar);
mycom.Parameters.Add("@dizhi", System.Data.OleDb.OleDbType.VarChar);
mycom.Parameters.Add("@youbian", System.Data.OleDb.OleDbType.VarChar);
mycom.Parameters["@id"].Value = id;
mycom.Parameters["@mingcheng"].Value = mingcheng;
mycom.Parameters["@dianhua"].Value = dizhi;
mycom.Parameters["@dizhi"].Value = dizhi;
mycom.Parameters["@youbian"].Value = youbian;
mycon.Open();
mycom.ExecuteNonQuery();
mycon.Close();
GV_kh.EditIndex = -1;
Bind();
Bind()里面已经定义了主键
这样还是不能把数据写入到数据库中。。。请高手指点