Prev: MVC
Next: Auto redirect http to https
From: Cubaman on 20 Jul 2010 03:47 On Jul 20, 1:18 am, "Alan T" <alan_NO_SPAM_pl...(a)yahoo.com.au> wrote: > Hi, > > I have installed both .NET connector and ODBC driver. > Since the connecting string format for MySQL is the same, how does ASP.NET > knows which one to use to connect? > > >http://dev.mysql.com/downloads/connector/net/- that is the download site > > > there is not much to change with this connector, but mainly sqlconnection > > to mysqlconnection etc > > >>>> What object should I use instead of SqlConnection? > > >>> Use either MySqlConnection or OdbcConnection. > > >>> I think the MySqlConnection is a download from the mysql site, but I'm > >>> not sure as I don't use it myself. > > >>> Personally I'd advocate using OdbcConnection (and OdbcDataReader etc) as > >>> you can then later change the type of database you are connected to > >>> without any change other than the connection string. I use > >>> OdbcConnection to connect to both MySQL and SQL Server (plus a few > >>> others). > > >> Hi, > > >> Could you give me some code that I can use to replace in my original > >> coding? Hello: I think your're confused with connectors. Odbc connections is a diferent technology than .Net data providers. Aspnet knows wich class to instantiate basically because you explicity write it in code. MySqlConnection class is diferent from OdbcConnection class. Take a look at here: http://www.geekpedia.com/tutorial139_Connecting-to-MySQL-with-Csharp-and-ODBC.html Best regards. |