ASP.NET use SqlConnection connect MySQL
as Darren seid "SqlConnection is for SQL Server." you need to install MySql.Data from NuGet: mySql.Data
also you can use Install-Package MySql.Data in your Package Manager Console
then you can create MySqlConnection object and connect to your database:
var cnn = new MySqlConnection("my Connection String");
SqlConnection
is for SQL Server. You need MySqlConnection
- this is not part of the .NET Framework, so you will have to download it and reference it in your project. You can then create a MySqlConnection
object and connect to MySQL in your application:
MySqlConnection connection = new MySqlConnection(myConnString);
You will also have to use the MySqlCommand
object rather than the SqlCommand
object.
http://dev.mysql.com/doc/refman/5.0/es/connector-net-examples-mysqlconnection.html