What i am doing is comparing current date with the 'date' field (which has certain date) in a table 'permanent_days' in MySql database (PhpMyadmin). Data type of that 'date' field is datetime. My source code is as follows:
double sum = previous_total + 0.5;
query = "UPDATE permanent_days SET total_days='"+sum+"' WHERE emp_id_fk='"+_ID+"' AND date LIKE '"+DateTime.Now.ToString("yyyy-MM")+"%'";
command = new MySqlCommand(query, connection, transaction);
command.ExecuteNonQuery();
After i execute this code, i am getting following exception:
Error: Incorrect datetime value: '2016-10% for column 'date' at row 1
Note that this comparison works fine while using 'Select' sql command. However, in 'Update' sql command (as mentioned above), this comparisons throws above mentioned exception. What can be the possible solution.