Greetings expert programmers,

Can someone guide me on how i will connect my 2008 to ms sql 2008 r2?

I already installed mssql 2008 r2, and when i try to add the connection it says i need to call the administator something like that even though i checked all the permission.

Is there another way on how to connect to mssql? if yes, please guide me.

Thank you in advance.

ok i already have the code for connecting vb to mssql but i'm having error on it.

The error says:

" network-related or instance-specific error occurred while establishing a connection to sql server. The server was not found or was not accessible. very that the instance name is correct and that sql server is configured to allow remote connections. (Provider: SQL network Interfaces, error:26 - Error locating server/Instance Specified."

That's the error i get from the connection.

Here's the code

Dim buildConString As New StringBuilder
        buildConString.Append("data source=JAKE-PC\SQLEXPRESS")
        buildConString.Append("; database=Ticketing")
        'buildConString.Append("; user id=")
        'buildConString.Append("; password=")

        _connectionString = buildConString.ToString()
        _prmList = New List(Of SqlParameter)
Public Sub ExecuteStoredProcedureWithReturnValue(ByVal spName As String)
        Dim cmd As New SqlCommand
        Dim con As New SqlConnection(_connectionString)
        Dim result As Short = 0
            _success = True
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = spName
            cmd.Connection = con
            If _prmList.Count > 0 Then
                For Each prm As SqlParameter In _prmList
            End If

            result = CType(cmd.ExecuteScalar, Short)
            If result = 1 Then
                _success = True
                MsgBox("Successful connection")
            End If
        Catch ex As Exception
            _success = False
            _message = ex.Message

            con = Nothing
            cmd = Nothing
        End Try

    End Sub
Dim dbHelper As New DbConnection
        With dbHelper
            .ExecuteStoredProcedureWithReturnValue("data source=JAKE-PC\SQLEXPRESS; database=Ticketing; trusted_connection=yes;")
        End With

I'm starting to see a pattern here.
Try this connection string, without using a StringBuilder.

_connectionString = "Data Source=JAKE-PC\SQLEXPRESS; Inital Catalog=Ticketing; Integrated Security=SSPI"

And the connection string cannot be passed as the name of a Stored Procedure.
It has to be the name of an existing Stored Procedure in the database server.

Edited 5 Years Ago by Oxiegen: n/a

This question has already been answered. Start a new discussion instead.