Im tryin to establish a connection to a gameserver sql database , i have spoken with the server provider and the connection is possible , ie allows remote connections , i can telnet the database . however im learning VB.NET and am trying to connect to for an app im trying to create , but im getting a connection error , does anyone here know VB and can assist.
Error Message :
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)
the error is on the line : conn.Open()
Code:
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim strConnection As String
strConnection = "Server=IP; UID=USERNAME; PWD=PASSWORD; Database=DB NAME; pooling=false"
Dim conn As New SqlConnection(strConnection)
Try
conn.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Dispose()
GC.Collect()
GC.WaitForPendingFinalizers()
End Sub
End Class
Error Message :
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)
the error is on the line : conn.Open()