I am using Net Framework 4 and Enterprise Liblary 5
After getting of instance
I try to execute a stored procedure
DbCommandinsertCommand = database.GetStoredProcCommand(spName, parameterValues);
An error “Invalid operation. Connection is closed” appears
I can workaround it by adding the next rows of code before calling ‘ExecuteNonQuery’
DbConnection connection = database.CreateConnection();
insertCommand.Connection = connection;
I think it is not a fine solution. In all examples it works without any workarrounding.
What is the problem?