Himadri
Himadri

Reputation: 8876

How to create database from codebehind in ASP.net 2.0?

I need to create database from codebehind in ASP.net 2.0.

Please help.

Upvotes: 0

Views: 657

Answers (1)

AndreyAkinshin
AndreyAkinshin

Reputation: 19021

May be like this:

SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand("CREATE DATABASE database_name", connection);
command.Connection.Open();
command.ExecuteReader();
connection.Close();

Upvotes: 1

Related Questions