AndyGB4
Posts: 122
|
Posted: 05/10/2013, 3:03 PM |
|
Hi, I'm having a problem setting up my data source the way I need it.
I have a table with appointments, and I want to show all appointments AFTER today.
(i.e. >= Today's Date)
I've tried everything combination I could think of, but it just isn't working for me.
When I try to put it in the where clause using paramenters it says "Conversion Failed when converting date from character string". And when I try to do it from an expression instead, I get "Can not find column "Date" or function is ambiguous".
I've tried many different ways to get Today's date, but they don't seem to be working.
Can anybody help me out on how to use today's date in my where clause?
I know it must be something simple, but I've been on this for a while and can't crack it!
Thanks guys.
|
|
|
Lucius
Posts: 220
|
Posted: 05/10/2013, 3:53 PM |
|
Would be helpful if you wrote for which DB you are trying to do this. Date handling is sometimes very DB-specific...
|
|
|
cvboucher
Posts: 191
|
Posted: 05/11/2013, 1:26 AM |
|
If putting in the where clause you should be able to set the DateColumn >= DateTime.Today();. If using an expression with Sql Server, you should be able to use DateColumn >= GETDATE().
Craig
|
|
|
pjcltd
Posts: 34
|
Posted: 05/13/2013, 12:01 PM |
|
Hi
what format are you storing the date in ?
US or UK
Short or Long
what is the field type that the date data is in ?
let us know this and i am sure we can do some thing for you.
Thanks
Paul
|
|
|
AndyGB4
Posts: 122
|
Posted: 05/13/2013, 12:47 PM |
|
Hey, thanks for the replies and sorry for the delay!
So I'm using MS SQL Server as my database.
The fields are of type "datetime",
and they are stored like this: 2013-05-13 10:30:00.000
I'll try your solutions right away Craig,
thanks for all the help guys.
|
|
|
pjcltd
Posts: 34
|
Posted: 05/13/2013, 1:25 PM |
|
can you put your sql on here please
|
|
|
AndyGB4
Posts: 122
|
Posted: 05/13/2013, 1:40 PM |
|
Hey everyone,
Craig's suggestions fixed it!
I knew it was something simple, but I just couldn't figure it out :S
Thank you so much for all your help,
you guys are great!
|
|
|
pjcltd
Posts: 34
|
Posted: 05/13/2013, 1:44 PM |
|
no problem
glad to help
|
|
|
pjcltd
Posts: 34
|
Posted: 05/13/2013, 1:44 PM |
|
no problem
glad to help
|
|
|