The code: This error shows up when I click the save button: System.InvalidOperationException: ‘ExecuteNonQuery requires an open and available Connection. The connection’s current state is closed.’ I am using the using keyword, if I’m correct doesn’t using automatically opens and …
Tag: sqlconnection
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; 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 …
C# SQLConnection.Open() hangs, with no exception
I am using C# in Visual Studio 2019, with Xamarin.Forms, and SQl in SSMS 2018 and have the below code (where [] is used to replace unneccessary information) When I run this, it hangs indefinitely at connection.Open(). Debug mode continues to run and appears to move on from Connection.Open(), but never reaches…
“Incorrect syntax near ‘)’.”
I have a program that is to take a couple inputs and do stuff to them then store them in a local database (using SQL Server). I have the following code for the connection: SqlConnection con = new …