-2

私が書いたように、パラメーター メソッドを使用して 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();
    }
}
4

1 に答える 1