I am saving a checkbox value using 'Yes' & 'No' and my problem is I have a button click that would allow the user to change the value.
So my logic is, if button is clicked the checkbox value that is no would change to yes.
Here is what I have to save the information originally:
public void StoredProcedure()
{
string privateItem = Private.Checked ? "Y" : "N";
connection.connection1();
if (connection.con.State == ConnectionState.Closed)
connection.con.Open();
using (SqlCommand cmd = new SqlCommand("SaveImage", connection.con))
{
cmd.Parameters.Add("@privatecheck", SqlDbType.Char).Value = Private.Checked;
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
connection.con.Close();
}
Basically I have a stored procedure in my database that will save my information.
Now what I was thinking to update one value is to basically do the same thing but it resulted in an error for me.
Any help on how to overwrite a previously saved checkbox value would be extremely helpful!
Thanks
Aucun commentaire:
Enregistrer un commentaire