Unrecognized Token : "#" C# to SQLITE

Posted by user2788405 on Stack Overflow See other posts from Stack Overflow or by user2788405
Published on 2013-10-29T15:51:48Z Indexed on 2013/10/29 15:53 UTC
Read the original article Hit count: 1301

Filed under:
|

Background + Problem:

( Begginer here ) I want to populate sqlite db with values from a list I have in my c# code. Here's the sqlite code taken from finisarsqlite website: I modified it a bit by creating my own column names like "seq#" etc.

But I'm getting the following error : "unrecognized token #"

Maybe my syntax is off?

Code:

             // [snip] - As C# is purely object-oriented the following lines must be put     into a class:

        // We use these three SQLite objects:
        SQLiteConnection sqlite_conn;
        SQLiteCommand sqlite_cmd;
        SQLiteDataReader sqlite_datareader;

        // create a new database connection:
        sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;New=True;Compress=True;");

        // open the connection:
        sqlite_conn.Open();

        // create a new SQL command:
        sqlite_cmd = sqlite_conn.CreateCommand();

        // Let the SQLiteCommand object know our SQL-Query:
        sqlite_cmd.CommandText = "CREATE TABLE table1 (Seq# integer primary key, Field integer primary key, Description integer primary key);";

        // Now lets execute the SQL ;D                                                                                  
        sqlite_cmd.ExecuteNonQuery(); <<< ---- This is where Error Occurs !

        // Lets insert something into our new table:
        sqlite_cmd.CommandText = "INSERT INTO table1 (Seq#, Field, Description) VALUES (list[0], list[1], list[2]);";

        // And execute this again ;D
        sqlite_cmd.ExecuteNonQuery();


        // We are ready, now lets cleanup and close our connection:
        sqlite_conn.Close();
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about sqlite