Page 1 of 1

Could not determine data type of parameter $1

Posted: Thu 30 Jan 2014 14:28
by radub
Hello,

Delphi 7
After upgrading to version 4.2.5, I encountered the error from title.
I have 2 tables in a master-detail, a provider and a clientdataset.
The script for the tables is:
  • CREATE TABLE dochd
    (
    docid integer NOT NULL,
    docno character varying(19) NOT NULL,
    docnoint character varying(25),
    docdate integer NOT NULL DEFAULT 0,
    CONSTRAINT pk_dochd PRIMARY KEY (docid)
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE dochd
    OWNER TO postgres;


    CREATE TABLE dynadoccodelnk
    (
    codeid integer NOT NULL,
    docid integer NOT NULL,
    codevalue character varying(50) NOT NULL,
    CONSTRAINT pk_dynadoccodelnk PRIMARY KEY (docid, codeid),
    CONSTRAINT fk_dynadocc_r_dynacod_dochd FOREIGN KEY (docid)
    REFERENCES dochd (docid) MATCH SIMPLE
    ON UPDATE RESTRICT ON DELETE RESTRICT
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE dynadoccodelnk
    OWNER TO postgres;

    CREATE INDEX r_dynacodelnk_doc_fk
    ON dynadoccodelnk
    USING btree
    (docid);
The provider has the OnDataRequest event:

Code: Select all

  PgTable1.FilterSQL:=Input;
  PgTable1.Open;
  Result:=DataSetProvider1.Data;
When activated, clientdataset is querying a null record (for initialization purposes):

Code: Select all

  with ClientDataSet1 do begin
    if Active then Close;
    Data:=DataRequest('DOCID=-1');
    Open;
  end;
The error occur after the next query:
  • SELECT * FROM dynadoccodelnk
    WHERE ( docid IS NULL AND :docid IS NULL)
Waiting for a solution.

Thank you,
Radu B.

Re: Could not determine data type of parameter $1

Posted: Mon 03 Feb 2014 15:08
by AlexP
Hello,

To solve the problem, you should set the PgQuery1.Options.UseParamTypes property to True

Re: Could not determine data type of parameter $1

Posted: Tue 04 Feb 2014 14:51
by radub
Yes, it works correctly.
Case closed.

Thank you,
Radu B.

Re: Could not determine data type of parameter $1

Posted: Wed 05 Feb 2014 14:07
by AlexP
Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.