0
我需要使用SQLite,但有一個與我的語法有問題(當然這就是唯一的例外是告訴我......),這裏是我的代碼:Mono.Data.Sqlite語法
using System;
using System.Data;
using Mono.Data.Sqlite;
class MainClass
{
public static void Main (string[] args)
{
string connectionString = "URI=file:SqliteTest.db,version=3";
SqliteConnection conn = new SqliteConnection(connectionString);
conn.Open();
SqliteCommand dbcommand = new SqliteCommand(conn);
string sql_command = "CREATE TABLE transaction (" +
"id INTEGER PRIMARY KEY," +
"datetemps TEXT NOT NULL," +
"description TEXT NOT NULL);";
Console.WriteLine(sql_command);
dbcommand.CommandText = sql_command;
dbcommand.ExecuteNonQuery();
dbcommand.Dispose();
conn.Close();
}
}
這裏的異常我收到:
Unhandled Exception: Mono.Data.Sqlite.SqliteException: SQLite error
near "transaction": syntax error
我已經習慣了使用MySQL,這不是第一次,我與數據庫的工作,但它是我第一次得到了這樣的問題,我只是想不通出了什麼問題,爲什麼會有'語法問題'。
感謝您的提示!
謝謝,我忘了該交易是一個關鍵字,並感謝您的關鍵字列表的鏈接:) – HexaGridBrain