Can you add global settings to connections

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 101
Joined: Tue 01 May 2007 16:36

Can you add global settings to connections

Post by ccmcbride » Tue 10 Aug 2010 17:36

For instance, I never, ever, ever, want to see the error 'update failed, 0 records'.
By default, it seems this flag is turned on.
so I've had to add code to set record options whenever a table is opened.
However, if I 'miss' a table, I get the error in unexpected places.

Would be SO much easier if I could just set the option on a connection, and the settings were copied to the table when the table is added.

Posts: 296
Joined: Thu 12 Oct 2006 09:34

Post by Ludek » Wed 11 Aug 2010 13:35

Hi, why don't you create a subclass with your preferred default and use only this class as global replacement for tmsquery? or you still don't have any subclass and using tmsquery as is?

BTW I really don't find general setting strictupdate = false to be a correct design pattern... I could count queries with strictupdate = false on my fingers in our code with a few millions of lines...

Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 12 Aug 2010 08:43

Ludek is right.
Also you can create procedures to create objects with the same options if you don't want to use subclasses.

Posts: 4
Joined: Fri 10 Sep 2010 14:37

change source

Post by wilton_rad » Fri 10 Sep 2010 18:19


constructor TDADataSetOptions.Create(Owner: TCustomDADataSet);
inherited Create;

FOwner := Owner;

RequiredFields := True;
StrictUpdate := True; --->> change for False
TrimFixedChar := True;
LongStrings := True;
FlatBuffers := False;
RemoveOnRefresh := True;
FDetailDelay := 0;
UpdateBatchSize := 1;
constructor Create(Owner: TCustomDADataSet);

property SetFieldsReadOnly: boolean read FSetFieldsReadOnly write FSetFieldsReadOnly default False;
property RequiredFields: boolean read FRequiredFields write SetRequiredFields default True;
property StrictUpdate: boolean read FStrictUpdate write FStrictUpdate default True; -->>change for False

Post Reply