I’m trying to connect a C# application (using Visual C# 2008 Express Edition) to a remote MySQL server. I have the drivers for this, but when I followed the tutorials (including adding the pooling and connection reset properties), I get an error that: Object reference not set to an instance of an object. I’ve included the two lines of code that should be making a connection. The error is thrown on the second line.
MySqlConnection connect = new MySqlConnection('database=d*******;Data Source=mysql.netfirms.com;user id=*******;pwd=*****;pooling=false;connection reset=false'); connect.Open();
I’d try setting the connection string outside of the constructor to help narrow down the issue:
If you do get the exception in the connect.ConnectionString = … line, then the problem is with the driver and sounds like you need to reinstall it.
I would also try a simpler connection string, without the pooling and reset keys.