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?
Setting DbxSda Driver Options via TSQLConnection
Re: Setting DbxSda Driver Options via TSQLConnection
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: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:- 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:For more information, please read the "Extended driver options" section of the dbExpress driver for SQL Server documentation (the Readme.html file).
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';
- 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';
Code: Select all
const
coTrimFixedChar = TSQLConnectionOption(103); // boolean
procedure TForm1.SQLQuery1BeforeOpen(DataSet: TDataSet);
begin
SQLConnection1.SQLConnection.SetOption(coTrimFixedChar, Integer(True));
end;