I get this error when I run the application Incorrect syntax near 12, on debugging I found that this error is caused due to the # along with the date.
Dim backdate as datetime
backdate = DateTime.Now.AddDays(-1)
on binding the data to the grid to filter the backdate records this error is caused Incorrect syntax near 12.
myqry = " select SRNO,SUBJECT,ID where datesend =" backdate
Now i am trying to extract only the date or shall I divide the date into day , month and year with DATEPART and take into a variable or convert the date or what should i do , Please help ???
This is the correct statement:
Cast and Convert: http://msdn.microsoft.com/en-us/library/ms187928.aspx
Convert with parameter 121 will convert to the following format: yyyy-mm-dd hh:mi:ss.mmm(24h), from that string, we get the first 10 characters (char(10)).
Without parameters: