🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #416

Problem with access database

#416
From: Daniel
Date: Fri, 17 Nov 2006 17:12
27 lines
1708 bytes
Hello,

     I am using BCB6, Access 2003 and ADO for a small application. I 
have a problem when I use datetime string in SQL.
     My code list blow,
     ...
     sql = "SELECT * FROM events WHERE started >= #11/12/2006# and 
started <= #11/17/2006 11:56:32#";
     ...
     adoQuery->Open();
     ...
     Then I got error message, "Parameter object is improperly defined. 
Inconsistent or incomplete information was provided.".
     So I found out if I do like this,
     ...
     sql = "SELECT * FROM events WHERE started >= #11/12/2006# and 
started <= #11/17/2006#";
     ...
     adoQuery->Open();
     ...
     This time it works. But both sql can be executed in Access if I 
just open query in Access.
     The 'started' field is DATE/TIME type in table Events.

     How do I fix it to query with time?

Thank
Technical Details
Message-ID: <455dedf8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,26d1ee675db50154,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 17 Nov 2006 12:12:32 -0500
From: Daniel <mzeng@eesensors.com>
User-Agent: Thunderbird 1.5.0.8 (Windows/20061025)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Problem with access database
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.75.32.9
Message-ID: <455dedf8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1163783672 24.75.32.9 (17 Nov 2006 09:14:32 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail