Windows Form
I want to create a database and tables in MS SQL Server 2005 using Windows form.is there any way i can do it?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nitesh KejriwalPosted Aug 24, 2013, 11:53 PM
You can so something like below -
string str1 = "CREATE DATABASE DB_NAME";
string str2 = "CREATE TABLE TBL_NAME ... .... ";
SqlCommand cmd = new SqlCommand(str1,sqlCon);
cmd.ExecuteNonQuery();
Anurag SarkarPosted Aug 24, 2013, 2:24 PM
Just Use the query and put the tables.
create database '"+TextBox1.Text+"';
Just Execute the query using like this.