🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.databases
Article #90

Re: Detecting the field names of a given table at run-time.

#90
From: kroma
Date: Thu, 13 Aug 1998 00:00
32 lines
1875 bytes
Bahri Okuroglu wrote in message <35D2A0DF.5B5EB515@rnd.netas.com.tr>...
>Hi all,
>
>I have some problems and do not know these can be solved using delphi:
>
>  1. Is it possible to detect the fields of a given table at run
>     time? You ask the user for a table in the database, and user gives
>     you a table name, say "employee".  And your code should detect the
>     field names of this table (for ex: your code should say that this
>     table has "emp_id" and "emp_name" fields.

What kind of database? Most SQL db's have a table that defines table
structures. Paradox does not.
You could always open up the table using a TTable and examine the Field
property. Look up TTable and TField for more info.


>  2. Using the pre-learned fields of a table, the code should be able to
>     make a query in the database. If you can get the field name as
>     strings, can you locate these string in any queries. (at run time)

Do you know SQL? Once you have the field names you can do anything you want.


>  3. Can I say, "Create a data label with the source of it pre-learned
>     table and releated field"?


Sure, why not, but do you know how to create a label at runtime?

        -- Kirk
Technical Details
Message-ID: <6quhaj$gq0@bgtnsc02.worldnet.att.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35D2A0DF.5B5EB515@rnd.netas.com.tr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,b1ab31d0c09b59c1,start
X-Google-Attributes: gidffff5,public
X-Google-Thread: ff75c,b1ab31d0c09b59c1,start
X-Google-Attributes: gidff75c,public
From: "kroma" <kroma@worldnet.att.net>
Subject: Re: Detecting the field names of a given table at run-time.
Date: 1998/08/13
Message-ID: <6quhaj$gq0@bgtnsc02.worldnet.att.net>
X-Deja-AN: 380710208
References: <35D2A0DF.5B5EB515@rnd.netas.com.tr>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: AT&T WorldNet Services
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop