Hi.
I have Delphi 7 and install Zeos Lib 6.6.6-stable.
I'm newbie and want start with MySQL on Delphi.
I have easy question for step by step ....
On new project I put to new form ZConnection and define user password and HostName.
question :
I how can I check if exists any database or no???
.. how can I check if exists any table on defined database???
.. how can I check how many record are in table ???
this easy question is my first .
Pls answer someone.
regards
Newbie easy question..
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Connect after adding 'dbless=true' to ZConnection.Properties.
Then you have the following ZConnection methods to retrieve this information:
procedure GetCatalogNames(List: TStrings);
procedure GetSchemaNames(List: TStrings);
procedure GetTableNames(const Pattern: string; List: TStrings);overload;
procedure GetTableNames(const tablePattern,schemaPattern: string; List: TStrings);overload;
procedure GetTableNames(const tablePattern,schemaPattern: string; Types: TStringDynArray; List: TStrings);overload;
procedure GetColumnNames(const TablePattern, ColumnPattern: string; List: TStrings);
Then you have the following ZConnection methods to retrieve this information:
procedure GetCatalogNames(List: TStrings);
procedure GetSchemaNames(List: TStrings);
procedure GetTableNames(const Pattern: string; List: TStrings);overload;
procedure GetTableNames(const tablePattern,schemaPattern: string; List: TStrings);overload;
procedure GetTableNames(const tablePattern,schemaPattern: string; Types: TStringDynArray; List: TStrings);overload;
procedure GetColumnNames(const TablePattern, ColumnPattern: string; List: TStrings);
Hi.
If I'm good understand then:
GetCatalogNames - list all databases in MySQL server , on this list can find my database
GetTableNames - list all tables in defined database
but what do you mean with this:
'dbless=true' to ZConnection.Properties
I'm beginner for MySQL database in Delphi.
I thinks so will good make more small example with easy function for all beginner like my.
and if I want list all data from defined field ????
how can do this ???
If I'm good understand then:
GetCatalogNames - list all databases in MySQL server , on this list can find my database
GetTableNames - list all tables in defined database
but what do you mean with this:
'dbless=true' to ZConnection.Properties
I'm beginner for MySQL database in Delphi.
I thinks so will good make more small example with easy function for all beginner like my.
and if I want list all data from defined field ????
how can do this ???
Hi.
For read all data from defined field to comboBox I use this :
I can use this or exist other way???
For read all data from defined field to comboBox I use this :
Code: Select all
i:=1;
while i <= ZQuery1.RecordCount do
begin
ComboBox1.Items.Append(ZQuery1.fieldByName('gvyrobca').AsString);
ZQuery1.Next;
i:=i+1;
end;
Combobox1.ItemIndex:=0;
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
ZConnection.Properties is a TStringList. Add a line to this list which contains 'dbless=true' This way the library knows it should connect to the database server without setting a database active.
Attention : you can use this for loading a list with available databases, but you should close this connection afterwards so you can reconnect with the chosen database. (don't forget to remove the 'dbless=true' from your connection properties)
Seeing your second question I think : 'Please, read some from the Delphi TDataset Help'. A TZQuery is a TDataset descendant, so in most cases it's behaviour is equal (or at least very similar).
For the answer of this question, have a look at TDataset.EOF documentation. For Delphi 7 the example is clear. I suppose it's clear for other Delphi versions too.
So here I refuse a more detailed example as you need to read more about working with Datasets before going on.
If you really can't work this one out after reading, please let me know.
Mark
Attention : you can use this for loading a list with available databases, but you should close this connection afterwards so you can reconnect with the chosen database. (don't forget to remove the 'dbless=true' from your connection properties)
Seeing your second question I think : 'Please, read some from the Delphi TDataset Help'. A TZQuery is a TDataset descendant, so in most cases it's behaviour is equal (or at least very similar).
For the answer of this question, have a look at TDataset.EOF documentation. For Delphi 7 the example is clear. I suppose it's clear for other Delphi versions too.
So here I refuse a more detailed example as you need to read more about working with Datasets before going on.
If you really can't work this one out after reading, please let me know.
Mark