Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello!
I use MySqlConnection.

VB
con = New MySqlConnection("Server=" + _host + ";User Id=" + _user + ";Password=" + _pass + ";")
 Private _host As String = "localhost\SQLEXPRESS"
    Private _user As String = "sava"
    Private _pass As String = "sava1"


It return me Try Catch as: Unable to connect to any of the specified Mysql hosts
All connections data is true, cheked it.
And that it is better to use with Mysql DataBase?
Posted
Updated 11-Mar-13 2:49am
v2
Comments
[no name] 11-Mar-13 8:57am    
Are you using MySQL or are you using SQL Server 2005?
_Vitor Garcia_ 11-Mar-13 8:59am    
same question here. It is always usefull this site : http://www.connectionstrings.com/
[no name] 11-Mar-13 9:02am    
I have SQL Server 2005 and try connect to it
_Vitor Garcia_ 11-Mar-13 10:16am    
Dear Junoli,
I don't use MySql. Yet, when i look at your code and see things like MySqlConnection i think immediatly in MySql.
Maybe you should use ADODB Connection instead.
http://msdn.microsoft.com/en-us/library/ms807027.aspx
Here you can search for details on this type of connection and in http://www.connectionstrings.com/ you can look after a connection string suitable to your case.

Here is an example on how to connect to SQL server database Pubs :

Dim cnn As ADODB.Connection = New ADODB.Connection
cnn.ConnectionString = "driver={SQL Server};" & _
"server=MySqlServer;uid=MyUserName;pwd=MyPassword;database=pubs"
cnn.Open

Best regards,
VG
Sergey Alexandrovich Kryukov 15-Apr-13 11:18am    
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership.
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

1 solution

You have SQLEXPRESS and try to connect to it using MySqlConnection. SQLExpress (Microsoft) and MySql (Oracle) are two completely different database engines.

Have a look here:
Beginners guide to accessing SQL Server through C#[^]

Good luck!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900