I'm inserting a DateTime type into my MySql table as type date. When trying to compare the date with the same DateTime type I get an exception: MySqlException: 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 'WHERE Date > '10/7/2017''.
I've tried applying the ToString() method to the DateTime and still get the same exception. From everything I've read it seems like the comparison should be straightforward.
My SQL statement is as follows:
var last30Days = DateTime.Today.AddDays(-30);
var sql = @"
SELECT * FROM table
WHERE Date >= @last30Days;";