Greetings,

To connect to a MySQL database you need to use MySqlConnection, SqlConnection 
is for MSSQL.

Have a good day,
Aaron

[Description: Description: Description: logo-email]

Aaron Childs, CCNA
Associate Director, Networking
Information Technology
www.westfield.ma.edu/it<http://www.westfield.ma.edu/it>
Please Note: new e-mail address - 
[email protected]<mailto:[email protected]>



From: [email protected] 
[mailto:[email protected]] On Behalf Of don rhummy
Sent: Monday, January 07, 2013 9:13 PM
To: [email protected]
Subject: [Mono-aspnet-list] Unable to connect to MySQL database with 
SqlConnection!

I get the error "Connection Refused"! I have the connection string correct from 
what I can tell. Both the DB and ASP.Net are on the same server.

    SqlConnection oConn = new SqlConnection( 
"Server=localhost;Database=testDB;Uid=root;Pwd=mypass" );
    oConn.Open();

I get this error:

System.Net.Sockets.SocketException: Connection refused

  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remote_end) 
[0x00000]

  at System.Net.Sockets.Socket+Worker.Connect () [0x00000]


Those exact connection settings work if I do it through ODBC and use a DSN. Why 
can't I get SqlConnection to work?


<<inline: image001.jpg>>

_______________________________________________
Mono-aspnet-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Reply via email to