The variable name '@value' has already been declared. Variable names must be unique within a query batch or stored procedure.
Must declare the scalar variable "@keyValue".
my code is here:
Expand|Select|Wrap|Line Numbers
- public partial class ECB_ECBConfiguration : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- DataTable dt = ECBDal.GetECBConfiguration();
- foreach(DataColumn col in dt.Columns)
- {
- if (dt.Rows.Count > 0)
- {
- txtECBAddress.Text = dt.Rows[0]["Value"].ToString().Trim();
- txtECBServer.Text = dt.Rows[1]["Value"].ToString();
- txtECBEMailID.Text = dt.Rows[2]["Value"].ToString();
- txtECBContactNo1.Text = dt.Rows[3]["Value"].ToString();
- txtECBContactNo2.Text = dt.Rows[4]["Value"].ToString();
- txtECBContactNo3.Text = dt.Rows[5]["Value"].ToString();
- txtECBContactNo4.Text = dt.Rows[6]["Value"].ToString();
- txtECBContactNo5.Text = dt.Rows[7]["Value"].ToString();
- }
- }
- }
- protected void btnSave_Click(object sender, EventArgs e)
- {
- using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["MSSQLConnectionString"]))
- {
- SqlCommand cmd = new SqlCommand("UPDATE ECB_Configuration SET [Value] = @value where [Key] = @keyValue", con);
- con.Open();
- cmd.Parameters.AddWithValue("@value", txtECBAddress.Text);
- cmd.Parameters.AddWithValue("@value", txtECBServer.Text);
- cmd.Parameters.AddWithValue("@value", txtECBEMailID.Text);
- cmd.Parameters.AddWithValue("@value", txtECBContactNo1.Text);
- cmd.Parameters.AddWithValue("@value", txtECBContactNo2.Text);
- cmd.Parameters.AddWithValue("@value", txtECBContactNo3.Text);
- cmd.Parameters.AddWithValue("@value", txtECBContactNo4.Text);
- cmd.Parameters.AddWithValue("@value", txtECBContactNo5.Text);
- cmd.ExecuteNonQuery();
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Updated Successfully')", true);
- con.Close();
- }
- }
- //protected void btnSave_Click(object sender, EventArgs e)
- //{
- // ECBDal.SaveECBConfiguration();
- //}
- }