Solved

Change database from application?

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now