in

System.Data.SQLite

An open-source, enhanced version of the SQLite database engine for Windows

Date Calculations - Need Help

Last post 10-11-2007 3:26 PM by JazzBass. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-10-2007 6:43 PM

    Date Calculations - Need Help

    Hello all!

     I'm trying to find the difference in months between a date column named DateCheckedOut and 'now'.  I've tried a few different things, but I haven't been able to get it right.

     I've looked at the SQLite Wiki, but I either can't understand how to get what I want or it doesn't address it.

    Thanks for any help!

    JB

     

  • 10-11-2007 6:20 AM In reply to

    • Sam_
    • Top 10 Contributor
    • Joined on 02-14-2007
    • Washington DC
    • Posts 63

    Re: Date Calculations - Need Help

    Is this for filter or display?

     

    If for filter then instead of performing a filter on a calculation, calculate the target date first.  For example, say you have a bugbase and you want to find open issues that are more than 2 months old, filter on "WHERE LastDate <= @TargetDate" and in .NET set @TargetDate to DateTime.Now.AddMonths(-2).

    If it's for display, then do the calculation in .NET when formatting the data.

     

    HTH,


    Sam

     

    We're hiring! B-Line Medical is seeking .NET Developers for exciting positions in medical product development in MD/DC. Work with a variety of technologies in a relaxed team environment. See ads on http://careerbuilder.com.
  • 10-11-2007 3:26 PM In reply to

    Re: Date Calculations - Need Help

     Thanks for the response, Sam.

     It's going to be just for display.  I want to show the user a column next to the 'LastDate' and show how many months it's been out.  I guess you can call this a calculated column.  The report itself is a html file with the data in a table.  I guess I can find it out using .NET and just add the value to the html table column when the html page is being built, but I was hoping it could included as part of the datatable I'm passing it.

     I'm using strongly typed datasets and the one the report is built from has a couple of different select queries based on different where clauses.  Then I'm sending the datatable to the reports class to read through and create the file.

    Thanks very much!

    JB 

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems