Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Posts
    19

    Date In SQLite Database

    Hello Every One.
    I have created a SQLite database with a table containing 10 colomns. One of the columns is date. I want to search the database using :
    "SELECT * FROM Mydatabe WHERE date BETWEEN 01/01/2008 AND 01/01/2009" , but the search failed.
    Could any one please help me with the syntax for date copare in SQLite.

  2. #2
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Don't store your dates like that, use ISO format (yyyy-mm-dd or yyyymmdd). That is the only date format SQLite understands for SELECT queries.
    Dermot

    I am so out of here

  3. #3
    Join Date
    Feb 2009
    Posts
    19

    Where Is My Error in SQLite Date Calling ?

    Thank You very much Dermot for you answer. I Formatted the date as you said. Now if I write the Date directly inside the SQLite.Query I get The result very Fine but when I use a variable which take the formatted date from an input box it says that "No records found" or the like..
    I don't Know where the error is ; Details of my work are:

    IN project Startup :
    db = SQLite.Open("C:\\MyDatabase.db");
    SQLite.Query(db, "create table tblBuy(ID integer primary key, name text, date date)");


    IN the Button to Search:
    --....................
    sQuery = "Select * from tblBuy where date between 'myX' and 'myY'";
    tBuy = SQLite.QueryToTable(db,sQuery);


    myX and myY are two variables containing the formatted date as yyyy-mm-dd. If I replace myX and myY with :
    sQuery = "Select * from tblBuy where date between '2009-05-01' and '2009-05-28'";
    tBuy = SQLite.QueryToTable(db,sQuery);

    --......................
    it works fine. Where I am doing error here ?
    To be sure that the formatting of date is as requiered I extracted the text into labels and inputs and they were good-formatted.
    Please Help me uncover this mystry!

  4. #4
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    You need to look in the help file to learn how to use variables.

    Code:
    sQuery = "Select * from tblBuy where date between '"..myX.."' and '"..myY.."'"
    Dermot

    I am so out of here

Similar Threads

  1. SQLite Database Browser - New Version!
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 9
    Last Post: 11-10-2009, 06:14 AM
  2. SQLite database in MEMORY only!
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 10-23-2009, 07:49 PM
  3. Populate Combobox with SQLite Database Help
    By David REMD in forum AutoPlay Media Studio 7.5
    Replies: 2
    Last Post: 09-29-2008, 01:52 PM
  4. How to convert access database to sqlite database.
    By sside in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 07-22-2008, 07:44 PM
  5. Database Actions
    By RizlaUK in forum AutoPlay Media Studio 7.5
    Replies: 7
    Last Post: 06-02-2008, 06:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts