Yeah! its me again – seems like I have to ask you very often these days…
My Problem this time:
I created a SQLite command to update some (not all) values in my table. Here is my code:
using (SQLiteConnection con = new SQLiteConnection(string.Format("Data Source={0};Version=3;", mstrDatabase)))
{
try
{
using (SQLiteCommand com = new SQLiteCommand("update WDATEN set TS_OUT = @TS_OUT, DATA_OUT = @DATA_OUT where ID = @ID", con))
{
com.Parameters.AddRange(new SQLiteParameter[]
{
new SQLiteParameter("TS_OUT", DbType.DateTime){ Value = date},
new SQLiteParameter("DATA_OUT", DbType.Double){ Value = numRest.Value}
});
con.Open();
com.ExecuteNonQuery();
mDa.Fill(dsWDaten.WDATEN);
con.Close();
}
}
catch (Exception ex)
{
MessageBox.Show("Beim Speichern des Datensatzes ist ein Fehler aufgetreten.\n" + ex.ToString(), "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Sadly every time I execute this code block – I get the exception:
SQLite error. Insufficient parameters supplied to the command.
Searching here and on other pages didn’t help me. What am I missing?
Your query has three parameters (@TS_OUT, @DATA_OUT and @ID) but you’re only supplying parameters for the first two, not for @ID.