Armin Khodaei
Armin Khodaei

Reputation: 141

Create Table LINQ TO SQL

I want to create a table in my database with LINQ TO SQL. This is what I have:

public void CreateUserTab(string nick) 
{
    string sqlCdm = string.Format("CREATE TABLE Customer (Nick nvarchar(30) PRIMARY KEY, AzetID nvarchar(30), RpText nvarchar(300), Your bit, Sing nvarchar(30), Time DateTime, OriginalTxt nvarchar(300))"); 
    _dc.ExecuteCommand(sqlCdm); 
    _dc.SubmitChanges(); 
} 

After executing this, my table does not appear in the database.

Upvotes: 1

Views: 1262

Answers (1)

Cristian Lupascu
Cristian Lupascu

Reputation: 40526

You have to provide a table name as a second parameter to the String.Format call.

Right now the {0} placeholder is not replaced.

Upvotes: 3

Related Questions