protected void btnSave_Click(object sender, EventArgs e)
{
string sql = @"UPDATE Users
SET Initials = @Ini
WHERE Common_Name = @cn";
using (var con = new SqlConnection("***"))
{
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
cmd.Parameters.AddWithValue("@cn", ddlUser.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Ini", txtInitials.Text);
cmd.ExecuteNonQuery();
con.Close();
}
}
Not really quite sure what is going on, I am unable to get this to update the database.
The only way I was able to get this work was not using parameters and hard coding it which is not what I'm looking to do.
I can provide more code upon request, wasn't quite sure if it is necessary.