CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2000
    Location
    india
    Posts
    49

    Select fields from table where datefield= ?

    I want to read records from a table on a datefield value.
    Regardless of database (Access ,SQL Server or Oracle) and local system date format setting , what is the Common syntax for SQL Statement.

    1) select fields from table where billdate = ?

    2) select fields from table where billdate betwen ? and ?

    Thanks is advance.


  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Select fields from table where datefield= ?

    If you are using DAO then you need to use the access syntax:


    Dim dtIn as date
    ssql = "SELECT * FROM Table WHERE BILLDATE = #" & Format$(dtIn, "mm/dd/yyyy") & "#"




    For RDO you use ' instead of #...

    (Although I don't knowe for sure that this works onm Access as I don't use that erm database)

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured