🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.dbexpress
1 messages
1 total messages Started by David Mon, 14 Feb 2005 17:51
using dynamically created result set
#135
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads