Re: ADODataset: Query parameter used twice in the SQL satatement

From: Michael Jacobs (iq193_at_earthlink.net)
Date: 08/08/04

  • Next message: Brian Bushay TeamB: "Re: Aggregates on DateTime fields"
    Date: Sun, 8 Aug 2004 17:42:45 -0400
    
    

    Hi Jim,

      You don't specify how you are setting the value of the parameter, so I am
    assuming you are using the 'ParamByName' method. What is happening is when
    the SQL statement is examined to set the parameter a match is found on the
    1st occurrence of 'MY_TIME_IN' and that conditions ends the search for a
    matching parameter. The problem you are encountering is that you have 2
    parameters in your statement even though you assigned the same name to them
    they are separate and distinct objects within the SQL statement.

    I hope this explanation helps.

    Regards,

    Michael

    "Jim Albertson" <jimalbertson@yahoo.co.uk> wrote in message
    news:4115d61a@newsgroups.borland.com...
    > ..will result in inconsistent results.
    >
    > eg. SELECT * FROM PUNCHCARD WHERE ( PUNCHCARD.TIME_IN > :MY_TIME_IN ) OR
    ( PUNCHCARD.TIME_OUT > :MY_TIME_IN )
    >
    > Query criteria will not apply for the second time MY_TIME_IN is used !!
    but if the SQL statement
    > is changed to:
    >
    > SELECT * FROM PUNCHCARD WHERE ( PUNCHCARD.TIME_IN > :MY_TIME_IN ) OR (
    PUNCHCARD.TIME_OUT > :MY_TIME_IN2 )
    >
    > Results are as expected.
    >
    > Is this by design or a bug? Gives me the creeps..
    >
    > JA
    >
    >


  • Next message: Brian Bushay TeamB: "Re: Aggregates on DateTime fields"

    Relevant Pages

    • Re: ADODataset: Query parameter used twice in the SQL satatement
      ... > Hi Jim, ... > You don't specify how you are setting the value of the parameter, ... > assuming you are using the 'ParamByName' method. ... > they are separate and distinct objects within the SQL statement. ...
      (borland.public.delphi.database.ado)
    • Re: Error : Item not found in this collection
      ... > Dim db As DAO.Database ... FIrst, the SQL statement for = date, the result needs to be ... If neither of these fixes the current problem, then post back with the line ... Jim C. ...
      (microsoft.public.access.queries)
    • Re: $sql = "update products set smallpicname = $myfile .....????
      ... Jim S. wrote: ... i tried your suggestion and it did not work. ... i want the value of $myfile to be in the $sql, but it is not doing it, ... how can i put variables in the $sql statement so i can execute it with ...
      (comp.lang.php)
    • Re: Dynamic WHERE statement
      ... > In case you haven't figured it out, this is a "windows XP setup and ... >> Now I am using an if statement that has the entire SQL statement in the ...
      (microsoft.public.windowsxp.setup_deployment)
    • Re: Error messageORA-00979: not GROUP BY expression
      ... > I'm writing an application on a Oracle 8 database in combi with the ... The OLE DB provider is Microsoft for Oracle. ... > When I replace manually the parameter:BU to a string in the sql statement ...
      (borland.public.delphi.database.ado)