Page 1 of 1

DefaultValues of TMSQuery info

Posted: Mon 28 Apr 2008 09:40
by Sergio Bertolotti
Dear Support,

I use last version of SDAC 4.x prof and Delphi 2007 with last service pack on MS Vista business with sp 1 in italian language.

I have a simple question...

With Delphi I create a simple project with a TMSConnection, TMSQuery,TDatasource,TDBNavigator and a TDBGrid .

I set with MSQuery editor SQL property : select * from and with your editor I generate Insert/Update/delete and Refresh statemnents.
After this I set options - DefaultValues of TMSQuery - equal true and compile my project.
I have a 3 fields :

FIELD1 type Bits/boolean default value 0
FIELD2 type datetime default value getdate()
FIELD3 type varchar(30) default value user_name()

I run my project and when I insert a record with Insert I see correctly the default value.
When I Edit a record and then Post value I don't see any changes in my 3 fields. In details FIELD2 is the same, the time is not changed...

Is it correct ?

Best regards.

Sergio Bertolotti

Posted: Tue 29 Apr 2008 09:24
by Antaeus
Default values are used on new record inserting when the field value is not provided. If you want to set the default field value on update, you should provide the default keyword in your queries instead of the field value. Please, take a look at this post for more information.

Posted: Tue 29 Apr 2008 15:24
by Sergio Bertolotti
Dear Antaeus,

many thank's for your answer.

Best regards.

Sergio Bertolotti