CREATE DATABASE statement not allowed within multi-statement transaction

后端 未结 5 727
广开言路
广开言路 2021-02-13 22:50

I\'m trying to build a quick test that deletes and recreates a database every time it runs. I have the following:

[TestClass]
public class PocoTest
{
    privat         


        
5条回答
  •  梦毁少年i
    2021-02-13 23:10

    You can not use implicit commits around certain SQL commands. Creating and Deleting databases is an example SQL server will do an AUTOCommit

    See the remarks section in the MS SQL help. http://msdn.microsoft.com/en-us/library/ms176061.aspx

    and something on Auto Commit for more info... http://msdn.microsoft.com/en-us/library/ms187878%28v=sql.105%29

提交回复
热议问题