🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #631

Re: Select First 2 Fields

#631
From: WillR
Date: Fri, 07 Sep 2007 16:25
48 lines
1981 bytes
Serra wrote:
> IB 6,02
> 
> I'm created a LookUp form
> with   SqlQuery,DSP,CDS ,  i want to
> get  first two fields of releated tables( Parts,Customers,Vendors.)
> 
> for example :
> MyQuery:='SELECT FIRST 2 FIELDS FROM '+ ComboBox1.Text
> SqlQuery.Sql.Add(MyQuery);
> Cds1.Open;
> if combobox.text='Parts then
> i want to get PartNo, PartName
> if combobox.text='Customers then
> i want to get CustNo, CustName
> ....
> Is it Possible to select just first 2 fields of a table ?
> 
> Thank you. 
> 
> 

Right from the help...


I presume you have a "TSQLConnection" --> To a Query, To DSP (Provider) 
to a CDS (Client Data Set) --> DataSource.

The use the Fields[i] method to pick off the first two fields...


CustTable->Fields->Fields[0]->AsString;

Bot that you can't do this directly from the SQL Component from the Dataset

Pull them up in help and look at the Hierarchy -- that should provide 
all the clues you need.

It's not SQL -- but then MSQuery is effectively a client app as well --- 
and that ain't SQL anyway.

Hope that helps.



-- 
Will R
PMC Consulting
Technical Details
Message-ID: <46e17b69$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46dffaf3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,a3faacd9a13e8f53
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 07 Sep 2007 12:25:45 -0400
From: WillR <willrNo.Spam.pmccl.noSpam.com>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Re: Select First 2 Fields
References: <46dffaf3@newsgroups.borland.com>
In-Reply-To: <46dffaf3@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 74.115.165.32
Message-ID: <46e17b69$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1189182313 74.115.165.32 (7 Sep 2007 09:25:13 -0700)
Lines: 48
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail