"Unable to connect to any of the specified MySql hosts" when connecting via C# -
the title pretty says all. when attempt connect sqlserver on namecheap hosted web server throws "unable connect of specified mysql hosts" error message.
any ideas?
using system; using system.windows.forms; using mysql.data.mysqlclient; using system.threading; namespace voting { public partial class form1 : form { public mysqlconnection connection; public string connectionstring; public form1() { initializecomponent(); } private void connect_click(object sender, eventargs e) { thread connectthread = new thread(new threadstart(databaseconnect)); connectthread.start(); } private void databaseconnect() { connect.text = "loading"; connectionstring = "server = mywebsiteishere; port = 3306; database = thisdatabase; uid = mypassword; password = myusername;"; try { connection = new mysqlconnection(); connection.connectionstring = connectionstring; connection.open(); messagebox.show("connection success!"); } catch (mysql.data.mysqlclient.mysqlexception ex) { messagebox.show(ex.message); } connect.text = "connect"; } } } i want note in connectionstring variable, server, database, uid , password in working order.
thanks help!
Comments
Post a Comment