protected void gvTasks_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
SqlConnection sqlConn = this.CreateDBConnection();
GridViewRow row = gvTasks.Rows[e.RowIndex];
string ID = gvTasks.DataKeys[e.RowIndex].Value.ToString();
string strSysResource = ((TextBox)gvTasks.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
SqlDataReader ds;
String update = "update task set SysResource='" + txtSysResource.Text + "' WHERE ID='" + txtID.Text + "'";
SqlCommand cmd = new SqlCommand(update, sqlConn);
sqlConn.Open();
ds = cmd.ExecuteReader();
gvTasks.EditIndex = -1;
sqlConn.Close();
GridViewBind(); }
{
SqlConnection sqlConn = this.CreateDBConnection();
GridViewRow row = gvTasks.Rows[e.RowIndex];
string ID = gvTasks.DataKeys[e.RowIndex].Value.ToString();
string strSysResource = ((TextBox)gvTasks.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
SqlDataReader ds;
String update = "update task set SysResource='" + txtSysResource.Text + "' WHERE ID='" + txtID.Text + "'";
SqlCommand cmd = new SqlCommand(update, sqlConn);
sqlConn.Open();
ds = cmd.ExecuteReader();
gvTasks.EditIndex = -1;
sqlConn.Close();
GridViewBind(); }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货