My own console

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Aventurine
Posts: 3
Joined: Mon 03 Nov 2008 22:06

My own console

Post by Aventurine » Sun 16 Nov 2008 14:50

Hello,
I need to do something like console of mysql (TRichEdit in Builder C++). How can i get all messages from mysql console and insert them into richedit (without TDBGrid)? For example, "select * from name_table" and i get strings in mysql console which will be inserted into richedit; "use name_database" - "database changed"; and so on.

Thanks

jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Post by jkuiper » Mon 17 Nov 2008 08:30

You always need TMyquery to get a dataset and / or Tmycommand to write to the database.
example (not tested):

Code: Select all

myquery.sql.text := 'select * from tablename';
myquery.active := true;
while not myquery.eof do
begin
  for t := 0 to myquery.fieldcount - 1 do
    strrecord := strrecord + ':' + myquery.field[t].asstring;
  richedit.items.add(strrecord); 
  myquery.next;
end;
myquery.active := false;

Post Reply