Easy way to update a field in database

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Easy way to update a field in database

Post by brace » Mon 15 Apr 2013 08:50

Whenevere I modify a field in DB for example from varchar(20) to varchar(40) i need to manually parse all datamodules to update the fields

is there a way to avoid this?

If a field (like USERID) is used a lot in an application the task of manually changing all the fields is long and tedious.

Thanks

AndreyZ

Re: Easy way to update a field in database

Post by AndreyZ » Mon 15 Apr 2013 11:39

You can avoid such problem by not using persistent fields. In this case, fields will be created automatically on dataset opening. If you want to use persistent fields, you should change fields in the dfm files manually after changing them on a server.

brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Re: Easy way to update a field in database

Post by brace » Mon 15 Apr 2013 13:53

Thanks for the reply.

It should be nice that (since I use persistent fields) the system accepts a nvarcahr(40) even if in the field definition it is written 30.

Is this possible in a future release?

So the idea is:
if the field definition has a Size smaller than the one found in Db the field could autoadapt to the newsize.
Even better: set this beahvior from the TMSConnection.Autoadapt new property so for one whole application this is defined once. Of course if the app uses more connections it will be set at every connection creation.

AndreyZ

Re: Easy way to update a field in database

Post by AndreyZ » Wed 17 Apr 2013 07:10

The behaviour you described is exactly the same when not using persistent fields. When there are no persistent fields, fields are created automatically using the meta information received from the server. If there are persistent fields, it means that you want to explicitly specify the correct options for these fields. All options of persistent fields are stored in the dfm file, so there is no way we can change these options. This can be done only by you, manually.

Post Reply