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 = new OdbcCommand();

OdbcDataAdapter da = new OdbcDataAdapter();

DataSet ds = new DataSet();

OdbcDataReader rd;

Connect to MysQL database using VB.NET on ASP.NET hosting

Dim MyConnection as OdbcConnection

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