m developing one application in 3 tier architecture,
but i can select records from database in same architecture but unable to create table?
Loading
m developing one application in 3 tier architecture,
but i can select records from database in same architecture but unable to create table?
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.
Jignesh TrivediPosted Jan 22, 2013, 4:48 AM
hi,
normally following code may help you to create table from C# code
SqlConnection con = new SqlConnection("Data Source=.\sqlexpress;user id=sa;password=test1!;Initial Catalog=TempDBfortesting;MultipleActiveResultSets=True");
SqlCommand command = new SqlCommand();
command.CommandType = CommandType.Text;
command.CommandText = "Create table testTable(Id int,name varchar(50))";
command.Connection = con;
con.Open();
int res = command.ExecuteNonQuery();
con.Close();
if you use same code still you can any error, please share errror as well as you Piece of code
hope this will help you.