Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
3 posts • Page 1 of 1
In pretty much the same way as with any other sql-based dataset- you setup a connection and link a MyQuery component to it.RiF wrote: how to retrieve data from my database with MyDAC ?
To setup a connection you use a TMyConnection component. The relevant properties are:
- Server - the address where the MySql server resides
- User - the MySql user to connect to the server
- Password - the user's password
- Database - the default database used in the connection
From this point on, you work as usual: specify the SQL statement in the MyQuery's SQL property, send out the query with its Open method, traverse the returned rows with its Next method using FieldByName to retrieve field values or bind MyQuery directly to whichever data aware controls you wish through a DataSource.