string updateSql = "UPDATE [RateCenters] " + "SET [RateCenterName] = @RateCenterName, [Province]= @Province, [QuantityThreshold] =@QuantityThreshold " + "WHERE [RateCenterID]=@RateCenterID"; string ratecenterID; protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; DropDownList ddl = (DropDownList)row.FindControl("DropDownList2"); TextBox rateCenterName = (TextBox)row.FindControl("TextBox1"); TextBox quantityThreshold = (TextBox)row.FindControl("TextBox2"); OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ToString()); OleDbCommand cmd = null; try { conn.Open(); cmd = new OleDbCommand(updateSql, conn); cmd.Parameters.Add("@RateCenterName", OleDbType.VarChar).Value = rateCenterName.Text; cmd.Parameters.Add("@Province", OleDbType.VarChar).Value = ddl.SelectedValue; cmd.Parameters.Add("@QuantityThreshold", OleDbType.VarChar).Value = quantityThreshold.Text; cmd.Connection = conn; cmd.ExecuteNonQuery(); GridView1.EditIndex = -1; GridView1.DataBind(); } catch (OleDbException ex) { throw (ex); } finally { cmd.Dispose(); conn.Close(); conn.Dispose(); } }
@RateCenterID is missing please add and try then
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)