2014-08-27 135 views
0

我有一臺運行Windows CE 6.0的摩托羅拉手持掃描儀,我開發了一個運行SQL Server 2008 R2數據庫的Windows窗體應用程序。我遇到的問題是通過手持設備建立數據庫連接。當我在本地測試連接建立罰款,但在掌上電腦上運行時,它會引發SQLException錯誤。Windows CE SQL數據庫連接錯誤

SQL實例已啓用命名管道。

下面是檢查連接是否建立的測試代碼。

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 

回答