Solved

Change database from application?

Posted on 1997-07-13
2
153 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 165
When I am typing into a TEdit last word repeats 7 147
Firemonkey webbrowser scrollbars ? 1 50
Multi-layered image in FireMonkey 9 49
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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