Update 2: I solved it, see my answer.
I am calling queries in a Microsoft Access database from C # using OleDb, but I cannot get my update requests to work.
An error does not occur, but updates are not saved to the database.
Can anyone shed some light on this?
SQL query in the database:
UPDATE tableName SET tableName.LastPolledDtg = LastPolledDtg
WHERE tableName.key = ID;
FROM#
OleDbCommand command = new OleDbCommand();
SetCommandType(command, CommandType.StoredProcedure, "NameOfQueryInAccessDatabase");
AddParamToSQLCmd(command, "@ID", OleDbType.Integer, 4, ParameterDirection.Input, id);
AddParamToSQLCmd(command, "@LastPolledDtg", OleDbType.Date, 4, ParameterDirection.Input, DateTime.Now);
using (OleDbConnection connection = new OleDbConnection("connectionString"))
{
command.Connection = connection;
connection.Open();
result = command.ExecuteNonQuery();
}
Connection string:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\Administrator\\Desktop\\dev\\src\\Website\\App_Data\\tracking.mdb"
Update 1:
I tried to narrow down the possibilities by creating a new database containing one table and one query, and access was closed when starting C # to update the table.
Updating is still not performed. I suspect this is a syntax problem (could there also be a problem with access rights?), But without error messages itβs pretty hard to debug them!