Hi guys,
I have a simple query to extract a product number from a small table.
I'm using the IB Express components from Delphi5.
Unfortunately I can't seem to get access to the return values from the
query.
I must be doing something fundementally wrong, but I'm missing it.
Can someone please put me right.

Cheers,
Simon.

The Interbase definition is :

CREATE DOMAIN ID_NUMBER AS INTEGER;

/* Table: PRODUCT, Owner: SYSDBA */
CREATE TABLE PRODUCT (
        PROD_ID ID_NUMBER NOT NULL,
        PROD_SOURCE CHAR(3),
        PROD_DESC VARCHAR(70),
        SOURCE_REF VARCHAR(15),
PRIMARY KEY (PROD_ID));


This is the SQL :

SELECT prod_id, prod_desc
FROM  product
WHERE (prod_source = :PROD_SOURCE) and (source_ref = :SOURCE_REF)

nb: This works fine in ISQL (with the parameters replaced with string values
of course), and I've tested the param values in IBQuery1 after the ".Open"
statement and they seem to have been accepted ok.


and this is how I'm trying to get the return value :

  IBQuery1.Close;
  IBQuery1.ParamByName('SOURCE_REF').AsString  := sProdCode;
  IBQuery1.ParamByName('PROD_SOURCE').AsString := sProdSource;

  try
      IBQuery1.Open;
      IBQuery1.First;
      iProd_ID := IBQuery1.ParamByName('prod_id').AsInteger;
  except
      ...
  end;


However, whenever I run it I get an exception :
"... exception class EDatabaseError with message IBQuery1: parameter
'prod_id' not found. Process stopped..."

Any Ideas ???

---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to