You can delete the database in ADO.NET or create a new one

I was looking for an example to delete a database and create a new one in C # using ADO.NET or etc for SQL Server.

The problem is that I need to create an instance of a new database for each new licensee, the client wants to create a separate database for each new licensee, I have never tried this before, and it’s hard for me to assess the feasibility,

+6
source share
2 answers

It is possible. This is actually an article about the MSDN Knowledge Base.

http://support.microsoft.com/kb/307283

Basically, you just connect to "master" or any database and send an SQL command to create the database.

That should get you started.

+6
source

I would look at SQL SMO for this.

There are examples everywhere about how this works. For example, check this one (http://www.codeproject.com/KB/tips/CreateSQLDV.aspx).

Everything that you can do manually in SQL Management Studio, you can do programmatically using SMO.

+2
source

Source: https://habr.com/ru/post/892190/


All Articles