How to connect to MySQL database using ASP.NET hosting

Many developers use ASP.NET with MySQL with their applicaions. If you use ASP.NET hosting services and some of ASP.NET languages as VB.NET or C# then you could connect to the MySQL databse using ODBC .net data provider.

Connect to MysQL database using C# on ASP.NET hosting

OdbcConnection cn = new OdbcConnection(“Driver={MySQL ODBC ODBC 5.2a Driver};Server=localhost or remote;Database=test;User=user;Password=pass;Option=3;”);

OdbcCommand cmd […]

How to create MySQL connection string

The following is a sample MySQL connection string:

Server=127.0.0.1;Uid=user;Pwd=userpassword;Database=allusers;

In this example, the MySqlConnection object is configured to connect to a MySQL server at 127.0.0.1, with a user name of user and a password of userpassword. The default database for all statements will be the allusers database.

Related TutorialsHow to create Oracle […]

Recommended ASP.NET Examples