hello dear friends

i installed visual studio ( full installation)

then i got xampp from their site

i have mysql and apache running

i downloaded the connector from mysql site and i created a simple project to check if i can connect to mysql or not i have made this code so far

Imports System.Data.SqlClient

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Connection As String = "Data source=localhost;user=root;password=;Initial Catalog=test;Integrated Security=true;"
        Dim cn As New SqlConnection(Connection)
        Catch ex As Exception
        End Try
    End Sub
End Class

im having trouble with an exception though it says

{"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"}

how can i get rid of this, is it because i installed mysql 2005 with visual studio 2008? and maybe it runs with xampp's mysql and creates these problems?

thanks in advance :))))

Connect strings are very tricky, especially if its a local machine as the syntax is different. I do not think it has anything to do with 2 versions of vb being installed. First you can google, "my sql connect strings" and should be able to find a page full of them. Look them over carefully as each example is for a different situation, or just try them until one of them works. I'm looking for my list. Ah I found it. For a local connection.. ups this is for ms sql.. lets see. Ok here is the connect string I use for a db on a remote server, the server name should probably be changed to '(local)'. String is: "Server=www.something.com; user id=me; password=mypassword; persist security info=TRUE; Database= mydbname" of course use your own login id and password and db name.
Hope this helps. Its worked for me in a lot of code.

As I recall, you may actually have to use the machine name as the server name, and make sure you have an imports statement like this "imports Mysql.Data.msqlclient" in the first line or two of your form. I also think you have to add a new connection in the server console before actually connecting.