C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

DateTime


Posted Date: 02 Nov 2009      Posted By: Naresh      Member Level: Silver     Points: 1   Responses: 4



Hi All

in my table i have date column using that i have to retrieve the data.
ALTER procedure [dbo].[S2Commerce_GetSalesReport]
@Filter nvarchar(50),
@fromdate datetime,
@todate datetime
exec S2Commerce_GetSalesReport Filter,'10/30/2009','10/31/2009'
when i exec this i not getting data i have data in my table for the date 10/31/2009.
exec S2Commerce_GetSalesReport ProductName,'10/31/2009','11/1/2009'
when i exec this i am getting data
tell me what is the problem
i comparing this using (orderDate<=@fromdate and orderDate>=@ToDate)
also if i pass same date for fromdate and todate i am not getting data.Like this
exec S2Commerce_GetSalesReport Filter,'10/31/2009','10/31/2009'
give me the solution it's urgent


Thanks








Responses

Author: Anuraj    02 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Try using Between operator instead of lessthan or equal to and greater than or equal to

like

DATE BETWEEN DATE1 AND DATE2

Thanks
Anuraj
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.
dotnetthoghts



Author: Naresh    02 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Hi Anuraj
With Between i am not getting fromdate and todate data



Author: Satish Kumar J    02 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

only compare the dates without time, may time comaparsion is causing the problem, check cast convert methods for converting date.

HTH

Regards,
Satish
My Blog



Author: Manick    02 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Check the passing parameter date format with database date format. It may cause the problem for date mismatch..

Regards,
Manick



Post Reply
You must Sign In to post a response.
Next : Uses of Coalesce function in SQLSERVER
Previous : Linq
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use