johan777
asked on
How can I display the defaults defined on the database in the fields on insert?
Hi all,
I'm using Delphi 7 with the excellent Devexpress component suites and MSSQL 2000 on XP.
I don't like coding the same things more than once and thus was wondering how would I go about to automatically display the default values (as defined in the database) in the relevant controls upon starting an insert.
I'm sure this must be possible and that I'm not the first to ask this.
Any comments are wlecome.
Regards,
Johan Swart
I'm using Delphi 7 with the excellent Devexpress component suites and MSSQL 2000 on XP.
I don't like coding the same things more than once and thus was wondering how would I go about to automatically display the default values (as defined in the database) in the relevant controls upon starting an insert.
I'm sure this must be possible and that I'm not the first to ask this.
Any comments are wlecome.
Regards,
Johan Swart
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi Alex,
Thanx for the response. I have decided to request this question closed as i did not receive an acceptable solution on this one.
I hope this is ok?
Regards,
Johan Swart
PS Sorry for taking so long, but the project I'm on was keeping me quite busy.
Thanx for the response. I have decided to request this question closed as i did not receive an acceptable solution on this one.
I hope this is ok?
Regards,
Johan Swart
PS Sorry for taking so long, but the project I'm on was keeping me quite busy.
ASKER
One can define the default on a column in the database. This default will be used if no value was supplied when a new record was inserted. also the default gets set by the DBMS and not via a trigger.
Alas, you are right, it seems that I would have to descend to such a vulgar way of programming as to write code to read the metadata if I want to prepopulate the defaults in the data-aware controls upon initiating an insert. :-(
I was just hoping there's a guru out there that knows of a way to do it swiftly, and cleanly.
.. I wonder if there is a generic routine to read the metadata via ADO, so that I do not have to write different code for each database type that I want to query?
I'll bump the points up to 500 if I can get a solution on this last question of mine.
Regards,
Johan Swart