L
loquak
Hello.
The following very simple code does not seem to accept the DateTime variable
as a parameter - why?
The table (MS Access db) here contains only a primary key and a column Date
of type date/time.
connection.Open();
transaction = connection.BeginTransaction();
commandString = "INSERT INTO [Events] (Date) Values(@Date)";
command = connection.CreateCommand();
command.CommandText = commandString;
command.Transaction = transaction;
OleDbParameter param_Date = new OleDbParameter("@Date",
OleDbType.DBTimeStamp); // Also tried DBTime and DBDate
param_Date.Value = date; // date == DateTime
command.Parameters.Add(param_Date);
// Execute command
command.ExecuteNonQuery(); // Syntax error in INSERT INTO statement???
The following very simple code does not seem to accept the DateTime variable
as a parameter - why?
The table (MS Access db) here contains only a primary key and a column Date
of type date/time.
connection.Open();
transaction = connection.BeginTransaction();
commandString = "INSERT INTO [Events] (Date) Values(@Date)";
command = connection.CreateCommand();
command.CommandText = commandString;
command.Transaction = transaction;
OleDbParameter param_Date = new OleDbParameter("@Date",
OleDbType.DBTimeStamp); // Also tried DBTime and DBDate
param_Date.Value = date; // date == DateTime
command.Parameters.Add(param_Date);
// Execute command
command.ExecuteNonQuery(); // Syntax error in INSERT INTO statement???