Please help with OCA connections string

jasonwucinski

Member
Joined
Mar 30, 2010
Messages
8
Programming Experience
1-3
hi everyone, I had last asked a question about having problems with connecting to a SQLCE database. I found out it was because I had to set a reference to SqlCe assembly. My next question is this:

Im trying to create an Occasionally Connected Application. When I try to connect to the local database I get this error:

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)


Here is the code I'm using:

VB.NET:
Expand Collapse Copy
        On Error GoTo Errorhandler
        Dim someName As String = Me.TextBox1.Text


        Using connection As New SqlConnection("Data Source = D:\Visual Studio\Projects\Work_Link_New_Applicant\Work_Link_New_Applicant\dbWorkLink.sdf;")

            Using command As New SqlCommand("INSERT INTO tblWorkLink_ID(WorklinkID) VALUES (@Name)", connection)

                command.Parameters.AddWithValue("@Name", someName)
                connection.Open()
                command.ExecuteNonQuery()

            End Using

        End Using

Errorhandler:
        Debug.Print(Err.Number & " " & Err.Description)
        If Err.Number = 0 Then
        Else

        End If

I've tried using SqlCE, and this didnt work (i got this error: Data conversion failed. [ OLE DB status value (if known) = 2 ])

Do i have to import some other assembly? Any help would be great.

thanks

jason
 
Back
Top