string updateSql = "UPDATE RateCenters SET RateCenterName = @RateCenterName, Province = @Province, QuantityThreshold = @QuantityThreshold" + " WHERE RateCenterID= @RateCenterID"; protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; DropDownList ddl = (DropDownList)row.FindControl("DropDownList2"); // assigning the dropdownlist item to 'ddl' TextBox rateCenterName = (TextBox)row.FindControl("txtRateCenterName"); // assigning textbox input item TextBox quantityThreshold = (TextBox)row.FindControl("txtQuantityThreshold"); // assigning textbox input item Label ratecenterid = (Label)row.FindControl("Label1"); // assigning the label value string scon = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\arjun.giridhar\my documents\visual studio 2010\Projects\BillingApplicationNew\BillingApplicationNew\App_Data\db1.mdb;Persist Security Info=False"; OleDbConnection conn = new OleDbConnection(scon); try { OleDbCommand cmd = new OleDbCommand(updateSql, conn); cmd.CommandText = updateSql; cmd.Parameters.Add("@RateCenterName", OleDbType.VarChar).Value = rateCenterName.Text; cmd.Parameters.Add("@Province", OleDbType.VarChar).Value = ddl.SelectedItem.Text; cmd.Parameters.Add("@QuantityThreshold", OleDbType.Integer).Value = Convert.ToInt32(quantityThreshold.Text); cmd.Parameters.Add("@RateCenterID", OleDbType.Integer).Value = Convert.ToInt32(ratecenterid.Text); conn.Open(); cmd.ExecuteNonQuery(); GridView1.EditIndex = -1; //refreshing GridView1.DataBind(); } catch (OleDbException ex) { throw (ex); } finally { conn.Close(); conn.Dispose(); }
cmd.Parameters.Add("RateCenterName", OleDbType.VarChar).Value = rateCenterName.Text;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)