Link to home
Start Free TrialLog in
Avatar of mphillip85
mphillip85Flag for United States of America

asked on

vb.net 2003. Filter Dataset on a datevalue field to capture between 30-60 days from the inv date.

vb .net 2003.  I would like to filter a dataset that has a invoice due date and do an aging report.  Filter for records that are between 30-60 days past the invoice due date.  How can I do this?
Thanks
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Are you looking to do this on the back-end database?  What database type are you connecting to?

Bob
Avatar of mphillip85

ASKER

SQL 2005 server.  I would prefer to pass the criteria through the dataset commandtext.  Otherwise I will have to create several datasets to connect to the view on the server.  I know that it will speed things up on the backend since it is a 8 processor server 8 gig ram. scsi drives.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am using this:

InvPaymentDueDate BETWEEN DATEADD(day,-59,InvPaymentDueDate) AND
DATEADD(day,-30,InvPaymentDueDate) ORDER BY InvPaymentDueDate

I even put the -30 to -1 and I know I have invoices that fall in that area and it did not get them
What am I doing wrong?

The InvPaymentDueDate >= DATEADD(day,-90,InvPaymentDueDate)  seems to take all the records.
Since I can't see the data, and I don't know about localization settings for your SQL Server instance, it is tough for me to spot any reason for your observations.

Bob
So I guess I will try in the view and see what results I get, on the server and trace it from there.
Whats the best way to actually see the query string results to see if the values are correct?
Can you give me an example of what I should expect.  Such as with your syntax replace the values that would actually be filtered against, since I must be missing some logic somewhere.  
Thanks.  
1) Is this SQL Server 2005 Express Edition?

2) Do you have SQL Server Management Studio installed?

Bob