I am trying to connect to SQL server from VB. An SQL server across the network uses my login for authentication.
I can access the server using the following python code:
import odbc conn = odbc.odbc('SignInspection') c = conn.cursor() c.execute("SELECT * FROM list_domain") c.fetchone()
This code works fine, returning the first SELECT result. However, I am trying to use SqlClient.SqlConnection in VB and it cannot connect. I tried several connection lines, but this is the current code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As New SqlClient.SqlConnection conn.ConnectionString = "data source=signinspection;initial catalog=signinspection;integrated security=SSPI" Try conn.Open() MessageBox.Show("Sweet Success") ''
It fails, and it gives me the error message "An error occurred with the network or a specific instance ... (provider: named pipe provider, error: 40 - Could not open connection to SQL Server)
I am sure this is my connection string, but nothing I found gave me any solid examples (server = mySQLServer is not a very good example) of what I need to use.
Thanks! -Wayne
source share