Two Calendar Controls
am 23.01.2008 18:23:00 von TomNowak
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.
RE: Two Calendar Controls
am 23.01.2008 20:16:02 von 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
"Tom Nowak" wrote:
> 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.
RE: Two Calendar Controls
am 23.01.2008 21:45:00 von TomNowak
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" wrote:
> 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" wrote:
>
> > 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.