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

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?
Updated 11-Mar-13 2:49am
[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 :
[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.
Here you can search for details on this type of connection and in 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};" & _

Best regards,
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.

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

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