Re: ADO - Access and TDate parameter

From: A Nonymous (a.nonymous_at_the.net)
Date: 09/19/04


Date: Sun, 19 Sep 2004 23:51:05 +0200

Don't know where you live but SQL *insists* on US date format:
#04/01/2004# means April 1, 2004

google around for a VBA function MakeUSdate in some MSAccess groups. Some
offer explanation.

HTH

"David M" <borlandnewsWITHNO@SPAMmoorhouse.net.nz> wrote in message
news:ednmf0tds3pfta9u499fstofqtfsjb3uai@4ax.com...
> Thanks for your help, but
>
> the only way I can get this to work is by embedding the date values
> into the SQL text.
>
> Regards
>
> David M
>
>
> On Mon, 5 Jul 2004 16:46:25 +0100, "Ana Alberts"
> <ana_alberts@hotmail.com> wrote:
>
> >I always explicitly declare the type of parameter when it comes to
dates...
> >and it seems to work fine.
> >
> >cmdManager.Parameters.Items[0].DataType := ftDateTime;
> >cmdManager.Parameters.ParamByName('param1').Value := dtpkTXN.date;
> >
> >Hope this helps.
> >Ana
> >
> >"David M" <borlandnewsWITHNO@SPAMmoorhouse.net.nz> wrote in message
> >news:9115e0doukmfpcoa2r5v281hsp61rujlu0@4ax.com...
> >> Hi,
> >>
> >> I have a MS Access 2000 database connected via TADOQuery in D7Ent
> >> running under Win XP Pro.
> >>
> >> My query fetches data from two tables including a nested SELECT as
> >> below ...
> >>
> >> with ADOQuery1 do begin
> >> Close;
> >> SQL.Clear;
> >> Parameters.Clear;
> >> SQL.Add('SELECT DISTINCT IH.InterventionID');
> >> SQL.Add('FROM InterventionHeaders AS IH INNER JOIN
> >> InterventionDetails AS ID ON IH.InterventionID = ID.InterventionID');
> >> SQL.Add('WHERE (ID.Quarter >= :StartDate1) AND (ID.Quarter <=
> >> :EndDate)');
> >> SQL.Add('AND NOT(IH.InterventionID IN (');
> >> SQL.Add('SELECT ID2.InterventionID FROM InterventionDetails
> >> ID2');
> >> SQL.Add('WHERE (ID2.Quarter <= :StartDate2)))');
> >> Open;
> >> end;
> >>
> >> Now here's the weird bit. If I hard code the parameters using the
> >> #mm/dd/yyy# format it works as expected.
> >>
> >> If I use the SQL as above and set params before opening as ...
> >> Parameters.ParamByName('startdate1').Value := EncodeDate(yyyy, mm,
> >> dd);
> >> ... then I get an empty result set back.
> >>
> >> Is this an ADO thing as I've run out of other ideas.
> >>
> >> Any suggestions will be appreciated.
> >>
> >> David M
> >>
> >
>



Relevant Pages

  • Re: Cool SQL Presentation At IDUG North America
    ... Google has some great stuff for connecting maps with data. ... >>> you could present your SQL. ... >>> If you will not be present at the conference, ...
    (comp.databases.informix)
  • Re: Database quandaries...
    ... I'm familiar with database manipulation in C++/MFC. ... here's a real dumb question: How do I *create* a SQL database? ... The best bet is to connect to a server and issue a DDL command to create the ... //Look for connection strings on google ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: SQL and Google (was: COBOL and DB2 vs. Java and DB2
    ... Do Google searches actually use SQL "under the covers"? ... Google database is MySQL. ... that SQL is less efficient than traditional mainframe databases, ...
    (comp.lang.cobol)
  • Re: kalender woche und sql server
    ... Mit google habe ich glaub ich das gefunden was du meintest: ... >> Es handelt sich um einen deutschen ms sql server 2000 mit Sprache ... aber BOL "CREATE FUNCTION" und dann das Beispiel ... Next by Date: ...
    (microsoft.public.de.sqlserver)
  • Re: Newbie question...Where to start?...(Compact Framework, SQL Server CE)
    ... There is an interesting web cast rather many webcast explaining SQL ... engine like MSN or Google to find what we want. ... what SQL Server CE toolsto use? ...
    (microsoft.public.dotnet.framework.compactframework)