Article View: borland.public.cppbuilder.database.ado
Article #4371Re: query to Listbox
From: David Barnes
Date: Wed, 16 Jan 2002 15:14
Date: Wed, 16 Jan 2002 15:14
36 lines
1731 bytes
1731 bytes
Here is an idea, I have not personally done this, but I think this
should work. ;)
ListBox1->Clear();
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add( "SELECT NAME FROM AUTHORS ORDER BY NAME ASC");
ADOQuery1->Open();
if( ADOQuery1->IsEmpty() )
return;
ADOQuery1->First(); //<-- Not necessary for I think ADO sets to
first but I always do anyways.
while( !ADOQuery1->Eof )
{
ListBox1->Items->Add( ADOQuery1->FieldByName( "NAME" )->AsString );
ADOQuery1->Next();
}
ListBox1->ItemIndex = 0;
See if that helps.
David Barnes
david@kalos-inc.com
JBird80 wrote:
> how would i load the items from a query into a dblistbox? i have been
> playing with it for a bit and cant seem to get it
Technical Details
Message-ID:
<3C4598CD.7070705@kalos-inc.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3c41c679_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,62b2f38f6e128816 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-01-16 07:21:48 PST Message-ID: <3C4598CD.7070705@kalos-inc.com> Date: Wed, 16 Jan 2002 09:14:21 -0600 From: David Barnes <david@kalos-inc.com> User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: query to Listbox References: <3c41c679_2@dnews> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 65.69.231.139 X-Trace: dnews 1011194061 65.69.231.139 (16 Jan 2002 07:14:21 -0800) Lines: 37 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews