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?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Anurag SarkarRank #1,049 · 1.8K reputationPosted Aug 24, 2013, 10:24 AM EDT
Just Use the query and put the tables.
create database '"+TextBox1.Text+"';
Just Execute the query using like this.
Nitesh KejriwalRank #253 · 9.9K reputationPosted Aug 24, 2013, 7:53 PM EDT
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();