krayna 0 Posted November 13 (edited) When I use FireDac with PostgresSQL and call "myQuery.Prepare()", I often have the problem that I have to define the param data type. Is it possible to have the data type of a parameter assigned automatically? qryWork.SQL.Text := 'select distinct(field1) from config c where c.field1 = :Name'; qryWork.Prepare(); // Here, I get the error, that data type of parameter 'Name' is unknown The same code with Firebird was never a problem. Is there a setting for this? And why can Firebird (or the FB driver) handle this and Postgres can not? Edited November 13 by krayna Share this post Link to post
Lajos Juhász 295 Posted November 13 (edited) You can set the datatype before prepare qryWork.Params[0].DataType:=ft...... the data type of field1. Edited November 13 by Lajos Juhász Share this post Link to post
krayna 0 Posted November 13 Yes, I know this, but with Firebird it was no problem even if I didn´t set the data type before calling prepare. It´s a big project and I would have to change a lot of code for this. I just wondered why this was never an issue with Firebird and now it´s a problem with PostgreSQL. Share this post Link to post
Lajos Juhász 295 Posted November 13 25 minutes ago, krayna said: Yes, I know this, but with Firebird it was no problem even if I didn´t set the data type before calling prepare. It´s a big project and I would have to change a lot of code for this. I just wondered why this was never an issue with Firebird and now it´s a problem with PostgreSQL. FireDAC is very strict. When I have moved projects from BDE and DBX that involved a lot of changes. Share this post Link to post
weirdo12 21 Posted November 15 On 11/13/2024 at 5:04 AM, krayna said: Yes, I know this, but with Firebird it was no problem even if I didn´t set the data type before calling prepare. It´s a big project and I would have to change a lot of code for this. I just wondered why this was never an issue with Firebird and now it´s a problem with PostgreSQL. What is the data type of field1? Can you share the schema of the config table? Share this post Link to post