Hi All
I am trying to connect mysql and VS 2003 but i am unable to do the connection, which makes me wonder if the are compatible. Can someone tell and also give me the code for connection.
Thanks in advance.
Hi All
I am trying to connect mysql and VS 2003 but i am unable to do the connection, which makes me wonder if the are compatible. Can someone tell and also give me the code for connection.
Thanks in advance.
Short answer: yes — Visual Studio 2003 can connect to MySQL 5.0, but because VS2003 targets the .NET Framework 1.1 you must use a driver/provider that supports that runtime. As noted, using ODBC is a reliable fallback; and pointed to the MySQL driver/download options.
If you want a native ADO.NET experience, install a MySQL ADO.NET provider that explicitly targets .NET 1.1, add a reference to the provider assembly (MySql.Data.dll) in your VS2003 project, then use the provider classes. Example (ADO.NET provider usage):
using MySql.Data.MySqlClient;
string conn = "Server=localhost;Database=mydb;Uid=root;Pwd=secret;";
using (MySqlConnection c = new MySqlConnection(conn))
{
c.Open();
// MySqlCommand / MySqlDataReader here
} If you prefer ODBC (the approach mentioned by ), either create a 32-bit DSN or use a DSN-less connection string from System.Data.Odbc. Example (DSN-less ODBC):
using System.Data.Odbc;
string conn = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=mydb;Uid=root;Pwd=secret;Option=3;";
using (OdbcConnection c = new OdbcConnection(conn))
{
c.Open();
// OdbcCommand / OdbcDataReader here
} Troubleshooting notes: on 64-bit Windows, use the 32-bit ODBC admin to create DSNs for 32-bit apps; if you see an authentication-protocol error, upgrade the client driver or recreate the MySQL user with a compatible password hash; ensure MySQL is listening on the expected port (3306) and firewalls aren’t blocking it. Finally, pick the approach that matches your project needs: native provider for best ADO.NET support, ODBC when a .NET‑1.1 provider isn’t available.
Jump to Post— Member #33065Haven't tried it, but you should be able to connect to the MySQL database via the System.Data.Odbc namespace. It will allow you to connect to any ODBC compliant DSN.
Haven't tried it, but you should be able to connect to the MySQL database via the System.Data.Odbc namespace. It will allow you to connect to any ODBC compliant DSN.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.