string tb0 = GridView1.Rows[e.RowIndex].Cells[3].Text.ToString().Trim();//DataKeyNames的值autoid,cell从0开始
string tb1 = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();//把选择的gridview行类型转换为TextBox类型
string sql="update 表 set syncmzid=@syncmzid where autoid=487";
string con= WebConfigurationManager.AppSettings["strcon"];
SqlConnection con = new SqlConnection(con);
try{
con.open();
SqlCommand cmd = new SqlCommand(sql, con);
int i= cmd.ExecuteNonQuery();//sql语句执行
if(true)
{
}
SqlDataAdapter ad = new SqlDataAdapter(cmd);
ad.Fill(ds, "data");
GridView1.DataSource = ds.Tables["data"].DefaultView;
GridView1.DataBind();
}