Revathi Parvathi

Revathi Parvathi

  • NA
  • 323
  • 64.6k

Cannot perform a shrinkdatabase operation inside transaction

Feb 8 2018 11:52 PM
While executing below-mentioned query in C# using Entity framework below-mentioned error occurred.Please find this.This query successfully executed in SQL server management studio.But not working on the C# code.Please, anyone, help me.
  1. var RunStoredProcedure1 = _context.Database.ExecuteSqlCommand("USE MDRFDataBase;  DBCC SHRINKDATABASE(N'MDRFDataBase' );  ");  
Cannot perform a shrink database operation inside a user transaction. Terminate the transaction and reissue the statement.

Answers (2)