how to access column of date/time data type from ms access

jaya3000

New member
Joined
Apr 16, 2006
Messages
2
Programming Experience
Beginner
hi , when i try to display a column from database (ms access) which is of date/time data type by selecting date from combo box using this statementsql = " select * from myTable where date_id=' " & cboDate.SelectedItem & " ' "it reports the following errorAn unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dllAdditional information: Cast from type 'DataRowView' to type 'String' is not valid. after that ,when i try this one it takes only date not time , how to change this format to take time'sql = " select * from myTable date_id='" & CDate(cboDate.Text).ToString("MM/dd/yyyy") & "'"please help me
 
Hi, wellcome to the forum :)
I am sorry to say this but your thread is very confusing ... it is not clear do you want to get time or date. You say time but then in your SELECT statement you are using MM/dd/yyyy ... could you rephrase the question please? Also, in your next post leave the format of the certain field (Short Date, General date ... ). How it was set within DB?

Regards ;)

In meantime you can take a look at this thread (you may find it useful) http://www.vbdotnetforums.com/showthread.php?t=6167
 
Back
Top