Skip to content
Advertisement

Tag: executenonquery

‘ExecuteNonQuery requires an open and available Connection. The connection’s current state is closed.’ – C#

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 closes the sqlConnection? If so, why does it returns an error that I need an open and available connection for

SqlCommand ExecuteNonQuery() not committing changes

I have a function in which i pass through some SQL and attempt to execute it against a database. The function completes fine and a SQL trace shows me that the query is being executed against the database, but when i refresh my select statement, the data has not updated. In this instance, the query is a simple: No errors

Advertisement