I'm trying to select all of the entries in an MS access database for a date chosen on a MonthCalendar control in my C# program. I ended up with something like this:
VB Code:
OleDbCommand selectCommand = new OleDbCommand ("SELECT DT, Task, Alarm FROM Schedule WHERE DATEPART('mmddyyyy', DT) = ' " + monthCalendar.SelectionStart.Date.Month + monthCalendar.SelectionStart.Date.Day + monthCalendar.SelectionStart.Date.Year + " ' ", dbConn)
Now this doesn't work when I end up executing the reader. It gives an OleDbException, "Invalid Procedure Call", and I think it has something to do with the DATEPART command.
Is there an easier way to select the date portion from the date chosen on the monthCalendar control? How about the date portion from the DateTime field from the database?
Thanx!![]()


Reply With Quote