Results 1 to 6 of 6

Thread: [RESOLVED] SQL Server 2012 Express Connection String

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Resolved [RESOLVED] SQL Server 2012 Express Connection String

    I have a VB2008 program accessing a Database. It's been working ok on SQL Server 2008 R2 Express using:
    Code:
        Private Sub frmLogon_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            AppName = My.Settings.AppTitle
            Me.Text = AppName + " - Logon"
            Try
                SQLcon.ConnectionString = "Server=.\SQLEXPRESS; Initial Catalog=EPOD; Integrated Security=SSPI;"
                SQLcon.Open()
            Catch ex As Exception
                MsgBox("Unable to Connect to EPOD Maintenance Database " + ex.Message, , AppName)
            End Try
        End Sub
    Having attached the Database to SQL Server 2012 Express, it fails to connect, the error being displayed is:
    "Unable to Connect to EPOD Maintenance Database 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: SQL Network Interfaces, error 26 - Error Locating Server/Instance Specified)"

    If I use VB6:
    Code:
    Private Sub Form_Load()
    Dim dbUser As String
    Dim dbPassword As String
    Dim dbName As String
    Dim dbServer As String
    Set db = New ADODB.Connection
    dbName = "epod"
    dbServer = ".\SQLEXPRESS"
    db.ConnectionString = "Provider = SQLNCLI11;Data Source=" & dbServer & ";Initial Catalog=" & dbName & ";Integrated Security = SSPI"
    db.Open
    End Sub
    the connection is fine.

    Any ideas ?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: SQL Server 2012 Express Connection String

    Is SQLcon an SQL* based object rather than an OLEDB* one?

    If so an OLEDB one (with the provider specified) will probably work, but not be ideal.

    There is presumably a setting for the SQL* objects (or an updated version you can download) which would enable it to work... but unfortunately I don't know what.

  3. #3
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: SQL Server 2012 Express Connection String

    Is there a possibility that other versions of SQL Server express editions are running on your computer?
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: SQL Server 2012 Express Connection String

    That's what I was wondering too... the post title mentions SQL Server 2012... and then the initial post mentions that it works fine with SQL Server 2008... which tells me there was SQL Server 2008 Express installed... and then SQL Server 2012 Expressed was installed. Which means you have TWO instances of SQL Server Express running. So you need to find out what the instance name is for the new SQL Server 2012 Express, since the default .SQLEXPRESS is probably pointing to the 2008 install.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: SQL Server 2012 Express Connection String

    Thanks for the responses.

    I'm very embarassed to say that there was another problem in the .Net code which was causing the 'last good build' to be used (a message which I completely misunderstood) and therefore was trying to use a different SQL Server instance since the source code changes I had made were ignored.

    Having corrected the other error it all works fine now.

  6. #6
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: SQL Server 2012 Express Connection String

    Quote Originally Posted by Doogle View Post
    Thanks for the responses.

    I'm very embarassed to say that there was another problem in the .Net code which was causing the 'last good build' to be used (a message which I completely misunderstood) and therefore was trying to use a different SQL Server instance since the source code changes I had made were ignored.

    Having corrected the other error it all works fine now.
    Glad to know that your issue has been resolved. Could you please mark this thread as resolved?
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width