|
-
Oct 16th, 2002, 10:51 AM
#1
Thread Starter
Lively Member
DatePart error
I hav this field 'Time' in my database (of the type date/time), and I use an System.data.oledb.OLEDBDataReader to read this field.
When simply response.write(DR.Item('Time')) to the browser i get this:
12-05-2002 20:05:00
However, if I use DatePart(DR.Item("Time"),"d") i get this error:
System.InvalidCastException: Argument 'DateValue' cannot be converted to type 'Date'.
Any suggestions?
Machine Language: You try to shoot yourself in
the foot only to discover you must first reinvent the
gun, gunpowder, the bullet, and your foot.
-
Oct 17th, 2002, 06:43 PM
#2
Hyperactive Member
you're probably better off returning a date from a sql server stored procedure that excludes the time:-
select convert(datetime, datepart(mm, datefield) + '/' + datepart(dd, datefield) + '/' + datepart(yy, datefield)) as date
Think that will work.
-
Oct 18th, 2002, 08:45 AM
#3
Thread Starter
Lively Member
Does that work in OLEDB also? I'm not using MS SQL server...
Machine Language: You try to shoot yourself in
the foot only to discover you must first reinvent the
gun, gunpowder, the bullet, and your foot.
-
Oct 20th, 2002, 01:55 PM
#4
Hyperactive Member
It's probably a different function in access. If you search under date functions you should find it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|