🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.dbexpress
Article #135

using dynamically created result set

#135
From: David
Date: Mon, 14 Feb 2005 17:51
47 lines
2482 bytes
Howdy,

I'm using dbexpress to connect to a MySQL database in order to
write a simple datbase browser. I can connect o.k. and am able to
populate 2 select boxes. The first shows all the db's on the
server, and when one is selected, the second is filled with the
tables from the selected databse. My question concerns how to 
use the reslut set from the 'select * from the
selected_db.selected_table'query. 

Here is the relevant block of code:

void __fastcall TForm1::ComboBox2Select(TObject *Sender)
{
    AnsiString SelectsFlds;
    TTransactionDesc SelectTblContentsTransaction;
    TSQLDataSet *fetchTblContents;

    if(!masterConnection->InTransaction){
      try{
          SelectsFlds.sprintf("select * from %s.%s",
          ComboBox1->Items->Strings[ComboBox1->ItemIndex],
          ComboBox2->Items->Strings[ComboBox2->ItemIndex]);

          SelectTblContentsTransaction.TransactionID = 4;
          masterConnection->StartTransaction(SelectTblContentsTransaction);
          masterConnection->Execute(SelectsFlds, NULL, &fetchTblContents);

          while(fetchTblContents->Eof == false)  
          RichEdit1->Lines->Add(fetchTblContents->);//stuck here
          fetchTblContents->Next();
          }
        masterConnection->Commit(SelectTblContentsTransaction);
      }

      catch(...){ masterConnection->Rollback(SelectTblContentsTransaction); }
   }
}  

I am trying to use the result set to poplualte a RichEdit widget.

First post to this list. Hope someone can shed some light...

Thanks very much,

David
Technical Details
Message-ID: <4210e513$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!ltu.se!luth.se!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: fb4e2,489bb4463f1ed3a1,start
X-Google-Attributes: gidfb4e2,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "David" <dpgirago@mdanderson.org>
Sender: "David" <dpgirago@mdanderson.org>
Reply-To: "David" <dpgirago@mdanderson.org>
Subject: using dynamically created result set
Newsgroups: borland.public.cppbuilder.database.dbexpress
X-User-Info: 143.111.106.67     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4210e513$1@newsgroups.borland.com>
Date: 14 Feb 2005 09:51:15 -0800
X-Trace: newsgroups.borland.com 1108403475 207.105.83.66 (14 Feb 2005 09:51:15 -0800)
Lines: 47
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!ltu.se!luth.se!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail