Solved

Change database from application?

Posted on 1997-07-13
2
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month10 days, 19 hours left to enroll

631 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