Use this code to create table dynamically in the SQL server,
SqlConnection con = new SqlConnection("Data Source=yourservername;Initial Catalog=yourdatabase;Integrated Security=True");
SqlCommand com = new SqlCommand();
con.Open();com.Connection = con;
com.CommandText = "Create table dyTab(id int,name varchar(100),age int)";
com.ExecuteNonQuery();
con.Close();
Here 'dyTab' is the Table Name
yourservername will be replaced by your server name
yourdatabase will be replaced by your database name
No comments:
Post a Comment