报错语句:SqliteException: SQLite error no such column:
- 这个坑的核心,是插值时候,字符串两端必须有"'"即单引号,否则可能报错
var mDbConnection = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;");
mDbConnection.Open();
const string sqlPart = @"REPLACE INTO watchList('cloumA', 'cloumB') VALUES ({0},{1})";
//此处需要强调的是,cloumA,cloumB必须有"'"存在,且valueA,valueB作为string插入时候,两端也必须有"'"即单引号
var sqlWords = string.Format(sqlPart, valueA,valueB);
var command = new SQLiteCommand(sqlWords, mDbConnection);
command.ExecuteNonQuery();
Console.WriteLine("write success");
mDbConnection.Close();