I'm trying to updata my sql database for a specific name, and the following code is not working. Any ideas why?
Here is what I am doing on the button click:
string person = listBox2.SelectedItem.ToString();
string memberStatus = "platinum";
string conn = "Data Source=.;Initial Catalog=myDB;Integrated Security=True";
using (SqlConnection connection = new SqlConnection(conn))
SqlCommand cmd = new SqlCommand("UPDATE Client Set Role = @Status WHERE Name = @name");
cmd.CommandType = CommandType.Text;
cmd.Connection = connection;
When I check the database, the Client's Role has not been updated. And when I debug, the value of person is "System.Data.DataRowView" Why is that? How can i fix it?