How to create table using LINQ technique in ASP.Net?
1 Answer
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 attend4days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Apr 19, 2012, 5:05 AM EDT
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.