DBGrid - multiple Table read with TZConnection, TZQuery Prob

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

DBGrid - multiple Table read with TZConnection, TZQuery Prob

Post by wseifert »

I try to use a DBGrid Object to display data from a MySQL database with 3 tables containing normalized data. So I created a test app, put TZConnection with connection information to the MySQL database, TZQuery (connection = TZConnection, SQL property = select * from tracks, album, artists where tracks.trArtistId = artists.ArtistId and tracks.AlbumId = album.AlbumId order by tracks.AlbumId), TDataSource (Dataset = TZQery) and DBGrid (Datasource = TDataSource) on a Form. Setting the TZQuery property "Active" to True a Messagebox pops up with Error "SQL Error: No Database selected". I have a TCP/IP connection to the database, so the database property in TZConnection is empty, other database properties I cannot find.
What is wrong? Any help is wellcome.

Greetings
Werner
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Just for the record : on 7 september I mailed this to Werner:
Werner,

I just saw your question pass by. I don't want to login to the forum now, but here's the answer :
For mysql you always have to use the database property, unless you prefix the table names in your query with the database name.
The value of 'database' is the name you use on the mysql command prompt in the 'use <database>;' command.
He replied this solved his problem.

Mark
Image
Post Reply