I’ve been looking all over the internet for an answer, and I didn’t find anything.
I am trying på make a connection between Visual Studio 2010 Ultimate and SQL Server Management Studio. I just made a small program just to see if the connection works.
Everytime I’m trying to connect, VS throws an ODBCexception.
“ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can’t connect to MySQL server
on ‘localhost’ (10061)”
This is my connectionstring:
DRIVER={MySQL ODBC 3.51 Driver};Data Source=MY-USERNAME\\SQLEXPRESS;Initial Catalog=MY-DATABASE;Integrated Security=True
This connection string was copied from a data connection I’ve made inside VS.
Do any one have the magic solution???
Please and thank you! 🙂
Best regards!
Right now, you’re mixing the MySQL driver (
DRIVER={MySQL ODBC 3.51 Driver}) with a Microsoft SQL Server Express server name (Data Source=MY-USERNAME\\SQLEXPRESS;) – which one do you really want to connect to??If you want to connect to SQL Server Express (which comes bundled with Visual Studio), you need to use the native .NET SQL client (and not the ODBC stuff).
In that case, your connection string would be something like:
or something similar – see ConnectionStrings.com for tons of samples.
In this case, you should use classes like
SqlConnection,SqlCommand,SqlDataReaderfrom theSystem.Data.SqlClientnamespace in your application.