SQL Server CE query error (unhandles exception). Executed from c# -


string query = "create table " + name +                 " (manpower_name nvarchar(50), instance int, start nvarchar(30), end nvarchar(30));"; 

i make of connection string in c# sql server ce database (a .sdf file). getting error, follows:

there error parsing query. [ token line number = 1,token line offset = 77,token in error = end ]

executed function:

public void create_proj_table(string name) {     string query = "create table " + name + " (manpower_name nvarchar(50), instance int, start nvarchar(30), end nvarchar(30));";      //open connection     if (this.openconnection() == true)     {         //create command , assign query , connection constructor         sqlcecommand cmd = new sqlcecommand(query, connection);          //execute command         cmd.executenonquery();          //close connection         this.closeconnection();     } } 

end reserved word in sql.

string query = "create table " + name + " (manpower_name nvarchar(50), instance int, start nvarchar(30), end nvarchar(30));"; 

if must use - i.e., don't want change name of row - enclose '[]', this:

string query = "create table " + name + " (manpower_name nvarchar(50), instance int, start nvarchar(30), [end] nvarchar(30));"; 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -