CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP.NET - InMotion Framework

 Current Date in Where clause of data source

Print topic Send  topic

Author Message
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.
View profile  Send private message
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...
View profile  Send private message
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
View profile  Send private message
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


View profile  Send private message
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.
View profile  Send private message
pjcltd

Posts: 34
Posted: 05/13/2013, 1:25 PM

can you put your sql on here please
View profile  Send private message
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!
View profile  Send private message
pjcltd

Posts: 34
Posted: 05/13/2013, 1:44 PM

no problem
glad to help
View profile  Send private message
pjcltd

Posts: 34
Posted: 05/13/2013, 1:44 PM

no problem
glad to help
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.