Skip to content
Advertisement

Update SQL table using C#

I’m trying to update EpisodeId no:117 in the Episode table and it executes successfully but when I check the table it is not updated. int episode Id = 117;

Advertisement

Answer

There are some issues with your SQL update statement.Look at following for reference to Update Statement in SQL LINK

There is also an easier way to add the parameters using the AddWithValue Method. LINK

Next, you are not executing the SQL command. For Update statements use the ExecuteNonQuery() method. LINK

Also as @Nikki9696 mentioned, episodeId is not declared. Make sure to declare episodeId with your other variables.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement