Dropping SQL Server database through C#

后端 未结 7 1885
误落风尘
误落风尘 2020-12-29 07:24

I am using this code to delete a database through C#

Int32 result = 0;

try
{
        String Connectionstring = CCMMUtility.CreateConnectionString(false, txt         


        
7条回答
  •  有刺的猬
    2020-12-29 07:55

    You should take a look at SMO. These allow you to manage all aspects of SQL Server from code, including deleting of databases.

    The database object has a Drop method to delete database.

提交回复
热议问题