正如我所写的,我无法使用参数方法更新我的 SQLite 数据库。
这是代码:
using (SQLiteConnection cnn = new SQLiteConnection("Data Source=BarMalnate.sqlite;Version=3;"))
{
using (SQLiteCommand command = new SQLiteCommand("UPDATE Concorso SET Controlla = @Controlla WHERE Numero = @Numero", cnn))
{
//example variable
int num = 2;
int mynum = 2;
command.Parameters.AddRange(new SQLiteParameter[]
{
new SQLiteParameter("@Controlla", DbType.Int32){ Value = num},
new SQLiteParameter("@Numero", DbType.Int32){ Value = mynum}
});
cnn.Open();
command.ExecuteNonQuery();
}
}