Does anyone know how to set default value for DBEdit?

Please discuss general Delphi programming topics here.

Does anyone know how to set default value for DBEdit?

Postby ssfftt » September 7th, 2005, 7:16 am

I have a DBEditPrice that represents the price of a service, how can i set its default value to 0 when i want to add a new service?
ssfftt
Active Member
Active Member
 
Posts: 9
Joined: September 6th, 2005, 5:02 pm

Postby Stefan » September 7th, 2005, 9:02 am

Normally you would do this at the database end:

CREATE TABLE Tab (
MyField Numeric(10,2) DEFAULT 0,...
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby Kambiz » September 7th, 2005, 10:10 am

In addition to what Stefan suggested, you can set the default value using the OnNewRecord event of the table.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

done!

Postby ssfftt » September 7th, 2005, 2:58 pm

well, i did it this way:

IBQServicePRICE.Value := 0;

thanks for all your advices
ssfftt
Active Member
Active Member
 
Posts: 9
Joined: September 6th, 2005, 5:02 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron