Two Calendar Controls

T

Tom Nowak

I want to build a form that contains two calendar controls. When the user
clicks dates on both, I want to go to a database and get records that were
added between the two dates. I am having problems setting up the SQL
statement. I want to so something like

SELECT name, employee, change FROM changes WHERE date1 >=
caldate1.selecteddate And date2 <= caldate2.selecteddate

but I am screwing up the syntax. Please help.

Please help.
 
M

Manish

I am not able to replicate the issue. I just used two calendar controls and
then used GridView and SQLDataSource control. in the SQLDatasource control, I
set the SelectQuery as

SELECT [OrderID], [CustomerID], [EmployeeID], [OrderDate] FROM [Orders]
WHERE (([OrderDate] > @OrderDate) AND ([OrderDate] < @OrderDate2))

where the orderdate and orderdate2 are the Parameters whose value is coming
from two Calendar controls selectedDate.

Regards,
Manish
www.ComponentOne.com
 
T

Tom Nowak

This fixed it. I have no idea what I was doing wrong. I have one more
question. One of the fields in my SQL 2005 Express database is type
datetime. When a user enters data by clicking on the calendar control, the
data appears as 01/23/2008 12:00:00 AM. I wanted to know how to get rid of
the 12:00:00 AM, and still have the date search mentioned below work. Please
help. Thanks for the solution to my first problem.

Manish said:
I am not able to replicate the issue. I just used two calendar controls and
then used GridView and SQLDataSource control. in the SQLDatasource control, I
set the SelectQuery as

SELECT [OrderID], [CustomerID], [EmployeeID], [OrderDate] FROM [Orders]
WHERE (([OrderDate] > @OrderDate) AND ([OrderDate] < @OrderDate2))

where the orderdate and orderdate2 are the Parameters whose value is coming
from two Calendar controls selectedDate.

Regards,
Manish
www.ComponentOne.com


Tom Nowak said:
I want to build a form that contains two calendar controls. When the user
clicks dates on both, I want to go to a database and get records that were
added between the two dates. I am having problems setting up the SQL
statement. I want to so something like

SELECT name, employee, change FROM changes WHERE date1 >=
caldate1.selecteddate And date2 <= caldate2.selecteddate

but I am screwing up the syntax. Please help.

Please help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top