- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
string commQuery = "CREATE DATABASE " + this.textBox1.Text +
" ON" +
" ( " +
"NAME =" + this.textBox1.Text + ", " +
"FILENAME =" + this.textBox2.Text +
"SIZE = 100mb, " +
"MAXSIZE = unlimited, " +
"FILEGROWTH = 5mb" +
" ) " +
"LOG ON " +
" ( " +
"NAME =" + this.textBox1.Text + ", " +
"FILENAME =" + this.textBox2.Text +
"SIZE = 3mb, " +
"MAXSIZE = 50mb, " +
"FILEGROWTH = 5mb" +
" ) ";
SqlConnection conSQL = new SqlConnection("Data Source = (local);" + "Integrated security = True;" + "database = master");
SqlCommand commSQL = new SqlCommand("", conSQL);
commSQL.CommandType = CommandType.Text;
commSQL.CommandText = commQuery.ToString();
conSQL.Open();
commSQL.ExecuteNonQuery();
conSQL.Close();
очень нравиться совершенство стиля формирования БД на сервере и защита от SQL иньекций :-D
Nagg 13.11.2010 18:36 # +1