Driver can not set up the TDBXCommon.Parameters

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
Eden0928
Posts: 62
Joined: Sun 22 Apr 2012 14:08

Driver can not set up the TDBXCommon.Parameters

Post by Eden0928 » Mon 23 Sep 2019 01:58

DBXCommon.TDBXCommand.Prepare

Prepare the command for execution

This method prepares the command for execution.

If no parameters have been set up, the driver supports parameter metadata and the dynamic SQL statement contains parameters, Prepare sets up the command's parameters.
My test code:

Code: Select all

procedure TForm2.Button1Click(Sender: TObject);
var
  LCommand: TDBXCommand;
begin
  LCommand := SQLConnection1.DBXConnection.CreateCommand;
  LCommand.Text := 'SELECT * FROM employee WHERE empno = ?';
  LCommand.Prepare;
  Memo1.Lines.Add(IntToStr(LCommand.Parameters.Count));
end;
The result always to get 0.

How to set the sqlcoonection.param what support auto create TDBXCommand.Parameters?

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Driver can not set up the TDBXCommon.Parameters

Post by Stellar » Wed 25 Sep 2019 14:50

Thank you for providing the information. We've reproduced the issue and started to investigate possible causes of the described behavior. We will let you know the results as soon as we get them.

Eden0928
Posts: 62
Joined: Sun 22 Apr 2012 14:08

Re: Driver can not set up the TDBXCommon.Parameters

Post by Eden0928 » Tue 22 Oct 2019 03:37

Hi
Do we have a date for the fix to be available?
Thanks

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Driver can not set up the TDBXCommon.Parameters

Post by Stellar » Wed 23 Oct 2019 13:53

We have fixed the issue with auto creation of parameters, and the fix will be included in the next build of dbExpress driver for SQL Server.

Eden0928
Posts: 62
Joined: Sun 22 Apr 2012 14:08

Re: Driver can not set up the TDBXCommon.Parameters

Post by Eden0928 » Tue 05 Nov 2019 02:28

Could you fixed the problem to all dbExpress driver product?

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Driver can not set up the TDBXCommon.Parameters

Post by Stellar » Fri 08 Nov 2019 13:42

At the moment, we cannot give you an exact date for when the next build of dbExpress driver for SQL Server will be released.
We can provide you with a nightly build of dbExpress driver for SQL Server that includes the fix of the issue with auto creation of parameters.
To get the build, please send us a request via the e-support form. (devart.com the "Support"\"Request Support" menu).

Eden0928
Posts: 62
Joined: Sun 22 Apr 2012 14:08

Re: Driver can not set up the TDBXCommon.Parameters

Post by Eden0928 » Mon 17 Feb 2020 07:43

Hi
I try the 8.1.3 trial.

But TDBXCommand.IsPrepared is always false, and TDBXCommand.Parameters.count is zero.

Could you tell me how to set the connection properties?

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Driver can not set up the TDBXCommon.Parameters

Post by Stellar » Mon 24 Feb 2020 16:00

Please use the syntax :<name> to place a parameter marker in a SQL statement when using Devart dbExpress driver for SQL Server. For example:

Code: Select all

procedure TForm2.Button1Click(Sender: TObject);
var
  LCommand: TDBXCommand;
begin
  LCommand := SQLConnection1.DBXConnection.CreateCommand;
  LCommand.Text := 'SELECT * FROM employee WHERE empno = :p1';
  LCommand.Prepare;
  Memo1.Lines.Add(IntToStr(LCommand.Parameters.Count));
end;

Eden0928
Posts: 62
Joined: Sun 22 Apr 2012 14:08

Re: Driver can not set up the TDBXCommon.Parameters

Post by Eden0928 » Tue 25 Feb 2020 07:05

Stellar wrote: Mon 24 Feb 2020 16:00 Please use the syntax :<name> to place a parameter marker in a SQL statement when using Devart dbExpress driver for SQL Server. For example:

Code: Select all

procedure TForm2.Button1Click(Sender: TObject);
var
  LCommand: TDBXCommand;
begin
  LCommand := SQLConnection1.DBXConnection.CreateCommand;
  LCommand.Text := 'SELECT * FROM employee WHERE empno = :p1';
  LCommand.Prepare;
  Memo1.Lines.Add(IntToStr(LCommand.Parameters.Count));
end;
Good!
After use Prepare method, TDBXCommand.Parameters.Count > 0.

However, why TDBXCommand.IsPrepared always is False?

ramyasri123
Posts: 1
Joined: Tue 25 Feb 2020 07:24
Contact:

Re: Driver can not set up the TDBXCommon.Parameters

Post by ramyasri123 » Tue 25 Feb 2020 07:32

Hi
Do we have a date for the fix to be available?
Thanks

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Driver can not set up the TDBXCommon.Parameters

Post by Stellar » Thu 27 Feb 2020 16:00

The fix was included in the latest version 8.1.3 of dbExpress driver, which is available for download on our website.

[email protected]
Posts: 7
Joined: Mon 24 Dec 2007 11:02
Location: Eindhoven, Netherlands

Re: Driver can not set up the TDBXCommon.Parameters

Post by [email protected] » Tue 17 Nov 2020 14:19

Hi,

We've updated dbexpsda40.dll today from version 7.4.6 to 8.3.1.
Delphi Tokyo 10.2 update 3

Parameters in the query are not found (TSQLQuery.Params.Count stays 0) and if I call TSQLQuery.PrepareStatement I get an AV in dbexpress250.bpl.

Help...

Kind regards

Mies

[email protected]
Posts: 7
Joined: Mon 24 Dec 2007 11:02
Location: Eindhoven, Netherlands

Re: Driver can not set up the TDBXCommon.Parameters

Post by [email protected] » Tue 17 Nov 2020 14:45

I'm sorry,

Problem solved. The SQLConnection wasn't properly initialized.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Driver can not set up the TDBXCommon.Parameters

Post by Stellar » Fri 20 Nov 2020 09:18

Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.

Post Reply