Search code examples
sqlsql-servervb.netwinformswindows-ce

Windows CE SQL Database connection error


I have a Motorola handheld scanner that is running windows CE 6.0, I developed a windows form app that runs off a SQL Server 2008 R2 database. The issue I am running into is establishing a database connection via the handheld device. When i test locally the connection establishes fine, but when running on the handheld it throws a SQLException error.

The SQL instance has named pipes enabled.

Below is the test code to check if a connection establishes or not.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Try
        Dim gDBConn As String = "Data Source=sqlserver;Initial Catalog=database;Persist Security Info=True;User ID=user;Password=password"  

        Dim myConnection As New SqlConnection(gDBConn)

        myConnection.Open()

        MsgBox("Established connection")

        myConnection.Close()

    Catch ex As Exception
        MsgBox(ex.Message.ToString)
    End Try

Solution

  • Try this :