Dropping SQL Server database through C#

后端 未结 7 1971
误落风尘
误落风尘 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:57

    Create sqlconnection object for different database other than you want to delete.

    sqlCommandText = "DROP DATABASE [DBNAME]";
    sqlCommand = new SqlCommand(sqlCommandText , sqlconnection);
    sqlCommand.ExecuteNonQuery();
    

提交回复
热议问题