I have a VB2008 program accessing a Database. It's been working ok on SQL Server 2008 R2 Express using:
Having attached the Database to SQL Server 2012 Express, it fails to connect, the error being displayed is: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
"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:
the connection is fine.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
Any ideas ?




Reply With Quote