🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#88
From: David M. Goncalves
Date: Thu, 13 Aug 1998 00:00
31 lines
2019 bytes
>   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.
>
Try the TTable.GetFieldNames method to get a list of names.

>   1. 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)
>
Locate? You can create a query at run time.  Is that what you mean?  See
http://www.dejanews.com for examples on basic query building.

>   1.
>   2. Can I say, "Create a data label with the source of it pre-learned
>      table and releated field"?
>
Hook up a datasource to the ttable in question.  Create the TdbText, set
its datasource and datafield properties.  That should work.

> Actually I want to let the user to select the table and the fields to
> be used in my application as data. Maybe there is another solution for
> this instead of the above tech.
>

Probably about a million ways! :-)

DMGoncalves
Technical Details
Message-ID: <35D2E5DE.E30AD144@vicon.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
X-Google-Attributes: gidffff5,public
X-Google-Thread: ff75c,b1ab31d0c09b59c1
X-Google-Attributes: gidff75c,public
From: "David M. Goncalves" <dmgoncal@vicon.net>
Subject: Re: Detecting the field names of a given table at run-time.
Date: 1998/08/13
Message-ID: <35D2E5DE.E30AD144@vicon.net>
X-Deja-AN: 380880682
Content-Transfer-Encoding: 7bit
References: <35D2A0DF.5B5EB515@rnd.netas.com.tr>
To: Bahri Okuroglu <bahrio@rnd.netas.com.tr>
Content-Type: text/plain; charset=us-ascii
Organization: Scanlon Associates
MIME-Version: 1.0
Reply-To: dmgoncal@vicon.net
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop