954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

SQL Compact Connection Problems

Set up my database through the wizard and copied the connection string it presented to me. But am having problems connecting to the actual DB. Error quoted below. Am I missing out on something?

Private Sub btnDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDB.Click
       Dim strConnect As String = "Data Source=|DataDirectory|\DB\BetJack\MyDatabase#1.sdf;Password=hello12?;Persist Security Info=True"
        Dim myConnection As SqlConnection = New SqlConnection(strConnect)
        Try
            myConnection.Open()
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Connection failed")
        End Try
        If myConnection.State = 1 Then
            MessageBox.Show("Connected")
        End If
    End Sub
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)
jackiejoe
Light Poster
41 posts since Nov 2008
Reputation Points: 10
Solved Threads: 0
 

_conn = New SqlCeConnection("Data Source = |DataDirectory|\;password=")

askbapi
Newbie Poster
1 post since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You