I would like to put a timestamp in a mysql in the database and I’m using the following code:
dim d as new date
dim rec as new DatabaseRecord
rec.Column("When") =d.SQLDateTime
Session.My_Database.InsertRecord "MY_Table", rec //Session hold the DB reference
session.My_Database.Commit
But SQL throw the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'When,) values ('2014-01-21 13:06:26')' at line 1
[quote=60474:@Jay Menna]I would like to put a timestamp in a mysql in the database and I’m using the following code:
dim d as new date
dim rec as new DatabaseRecord
rec.Column("When") =d.SQLDateTime
Session.My_Database.InsertRecord "MY_Table", rec //Session hold the DB reference
session.My_Database.Commit
But SQL throw the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'When,) values ('2014-01-21 13:06:26')' at line 1
I can pass straight strings in but not Datetime.
What am I missing?[/quote]
Try
dim d as new date
dim rec as new DatabaseRecord
rec.DateColumn("When") = d
Session.My_Database.InsertRecord "MY_Table", rec //Session hold the DB reference
session.My_Database.Commit