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
DBGrid - multiple Table read with TZConnection, TZQuery Prob
Moderators: gto, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Just for the record : on 7 september I mailed this to Werner:
Mark
He replied this solved his problem.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.
Mark