Setting DbxSda Driver Options via TSQLConnection

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
condev
Posts: 1
Joined: Thu 19 Jul 2012 21:06

Setting DbxSda Driver Options via TSQLConnection

Post by condev » Thu 19 Jul 2012 21:51

I can see where it uses DriverProperties in the DBXDevartSQLServer.pas file, and can find those values defined in the DriverOptions.pas file, but I cannot see how to set those options when using the DevartSQLServer driver with a dbExpress TSQLConnection component.

Setting the Params using the text codes from DriverOptions, such as 'TrimFixedChar' and 'CommandTimeout' doesn't seem to work. Is there something special I need to do, such as set the ConnectionProperties of the DBXConnection?

AndreyZ

Re: Setting DbxSda Driver Options via TSQLConnection

Post by AndreyZ » Fri 20 Jul 2012 07:43

Hello,

If you are using CodeGear RAD Studio 2007 and higher, you can set up dbExpress driver for SQL Server extended options using the following code:

Code: Select all

SQLConnection.Params.Values['Option Name'] := 'Option Value';
If you are using an earlier IDE version than CodeGear RAD Studio 2007 IDE version, please note that dbExpress technology in these IDEs has restrictions on using extended options. So, to use extended options, you can use two ways:
- use our TCRSQLConnection component (both in design-time and run-time) that serves to overcome restrictions of dbExpress technology in the following way:

Code: Select all

CRSQLConnection.Params.Values['Option Name'] := 'Option Value';
- use the TSQLConnection component (only in run-time). To use an option with TSQLConnection in Delphi 2006 and lower IDE versions, you should define constants and set appropriate option values using event handlers like TSQLConnection.AfterConnect or TSQLQuery.BeforeOpen . Here is a code example that demonstrates setting extended driver options in Delphi 2006 and lower IDE versions:

Code: Select all

const
  coTrimFixedChar = TSQLConnectionOption(103); // boolean

procedure TForm1.SQLQuery1BeforeOpen(DataSet: TDataSet);
begin
  SQLConnection1.SQLConnection.SetOption(coTrimFixedChar, Integer(True));
end;
For more information, please read the "Extended driver options" section of the dbExpress driver for SQL Server documentation (the Readme.html file).

Post Reply