How to create table using LINQ technique in ASP.Net?
How to create table using LINQ technique in ASP.Net?
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 Apr 19, 2012, 9:05 AM
Hi,
I think you can achive this using IDbCommand object which in System.Data namespace.
Example:
IDbConnection conn = (Context.Connection as EntityConnection).StoreConnection;
conn.Open();
using (IDbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "CREATE TABLE JigneshTest(id int, name varchar(50));";
cmd.CommandType = CommandType.Text;
cmd.CommandTimeout = 0;
cmd.ExecuteNonQuery();
conn.Close();
}
This code is created in framewotk 4.0..
Here context is your DBcontext.
hope this help.