Wednesday 7 August 2013

select all from table where datetime Greater than Timestamp? from C# to mysql

select all from table where datetime Greater than Timestamp? from C# to mysql

Ok here is my C# code snippet:
Updated is the time-stamp column of the table in mysql.
hair is a datetime variable which I format into the correct format
MySqlCommand command = new MySqlCommand(
"SELECT *"
+ "FROM smartstyle.table_changes_logger"
+ "WHERE Updated = @logout_datetime ;", connection);
command.Parameters.Add("@logout_datetime",MySql.Data.MySqlClient.MySqlDbType.Timestamp).Value
= hair.ToString("yyyy-MM-dd hh:mm:ss");
connection.Open();
but I am getting the following error why?
"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 '=
'2013-08-06 02:12:09 '' at line 1" string

No comments:

Post a Comment