|
-
Mar 20th, 2013, 02:53 PM
#1
[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 ?
-
Mar 21st, 2013, 07:10 AM
#2
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.
-
Mar 21st, 2013, 08:05 AM
#3
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
-
Mar 21st, 2013, 08:24 AM
#4
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
-
Mar 22nd, 2013, 01:24 AM
#5
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.
-
Mar 22nd, 2013, 07:52 AM
#6
Re: SQL Server 2012 Express Connection String
 Originally Posted by Doogle
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|