I am trying to write an insert method in a C# console application. I have set a breakpoint and it does hit ExecuteNonQuery
, however, after stepping through it just hangs there and control does not seem to return back to the application. When I perform a read action on the database it works perfectly.
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand("INSERT INTO dbo.dbDevices (ipAddress) VALUES (@value)", connection);
command.Parameters.Add("@value", "SUCCESS");
command.ExecuteNonQuery();
}
I have also checked the active connections to the database and it says that it is awaiting command.
.Net SqlClient Data Provider 5720 AWAITING COMMAND
More information can be provided if needed.