8

I need to write an WPF(4.0) application which has a DB but no tables in it. The app has to create some tables in the DB and then start working with them. I am wondering , is there a way to do it in Linq to SQL ?

1
  • 1
    How could Linq create tables? Commented Apr 9, 2012 at 5:41

1 Answer 1

2

You can do this programatically. i.e. You can create programatically your tables, according to given parameters, also it is possible to build the relations between tables... :)

As there is no direct function create table, you can use the ExecuteCommand -method of the DataContext to run some T-SQL statements for creating tables.

Sign up to request clarification or add additional context in comments.

3 Comments

you mean ADO.NET , yes? yeah , I know it's can be generated programatically in ADO.NET but I was hoping that there is an option now to do it by LINQ to SQL...:)
N.D. To Create a New Table try this exemple: wikihow.com/Use-LINQ-to-SQL-in-C-Sharp#Create_a_New_Table is an exemple of what I suggested you to do in my second part of response
Thanks , but I have seen that people have some troubles with that , have you tried this solution personally ? I will try it , but I wonder if it really works?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.