I am trying to insert a record into a table in C#, but when I get to the line of code to execute the query to insert the record into the table, it just comes up with this error:
An exception of type 'System.Data.SQLite.SQLiteException' occurred in System.Data.SQLite.dll but was not handled in user code
Additional information: datatype mismatch
The code that I have to insert the data into the database is as follows:
string stmt = string.Format("INSERT INTO quotes (id, user, quote, date) VALUES ('', '{0}', '{1}', '{2}')", person, quote, date);
SQLiteCommand cmd = new SQLiteCommand(stmt, connection);
int rowsAffected = cmd.ExecuteNonQuery();
person
, quote
and date
are all strings and the structure of the database is as follows:
id = INTEGER PRIMARY KEY
, user = STRING(255)
, quote = STRING(255)
and date = STRING(255)