VS .NET: Connecting to MySQL
Posted on 2006-11-12
I would like to connect to a MySQL database from VS .NET.
The MySQL server is on another computer, connected in LAN.
I have tried various ways but failed to do it because I don't really understand the concept.
(For Delphi programmers)
I can do it in Delphi, quite simple:
- Drop a TDatabase, set AliasName to testdb (In BDE, the type is MySQL ODBC 3.51 Driver), and DatabaseName to testdb (this is the database in the MySQL server, not to be confused with the previous one).
- Drop a TQuery, setting DatabaseName to testdb, SQL to "select * from tb_customer"
- Drop a TDataSource and a TDBGrid, setting their DataSet and DataSource
- Activate/enable all of them, and the data in table tb_customer is already shown without even compiling/running it.
How can I do the same thing in VS .NET?