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)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Connection failed")
        End Try
        If myConnection.State = 1 Then
        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)

_conn = New SqlCeConnection("Data Source = |DataDirectory|\<yourDatabaseName>;password=<your Password>")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.