I am using this code to delete a database through C#
Int32 result = 0; try { String Connectionstring = CCMMUtility.CreateConnectionString(false, txt
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.