Solved

Change database from application?

Posted on 1997-07-13
2
151 Views
Last Modified: 2010-04-06
Is it possible to change a database field-name from within a running application?How do I do it? As an example: Say I have a database that looks like this:
Fields: Cartype   Color   Prize   Weight   Height
Posts:
        Sedan     Red     12000$   1200 Kg 1.2 m
        Truck     Gray    86000$   6500 Kg 3.2 m
        Racer     Green   45000$   800  Kg 0.85 m
Now! How do I change for example the fieldname "Prize" to "Cost" from an running application?
PS. I run Delphi Developer 2.0 and the database is a Paradox-base...
Thanks!
Erik N
0
Comment
Question by:Erik N
2 Comments
 
LVL 2

Expert Comment

by:icampbe1
ID: 1338727
Do you want to change the field name just for the one run of the application, or do you want it changed permanently??
0
 
LVL 1

Accepted Solution

by:
Zonnald earned 100 total points
ID: 1338728
The field-name within the application is probably not what you want to change.  I assume that it is the label displayed on the form that is relavent to you.  Obviously you can set up some logic in the OnShow method of the form to change the field labels.

Alternatively if you are displaying the Posts using a dbGrid component then you can also use logic to change the field's 'DisplayLabel' i.e.

         tblName.fieldbyName('Prize).Displaylabel := 'Cost';

Simarily you can also control other properties of the column :

        with tblName do
        begin
            fieldbyName('Prize').Visible          := true;
            fieldbyName('Prize').Readonly     := true;
            fieldbyName('Prize').DisplayWidth := 10 ;
       end;

I hope this is useful to you.

Zonnald.




0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question