問候語,SQL Server CE 3.5的私有部署導致使用SqlCeConnection的錯誤
我正在嘗試爲SQL Server Compact進行專用部署。我在正確遵循了一切:http://erikej.blogspot.com/2012/05/private-deployment-of-sql-server.html但仍沒有運氣:(
它給我一個錯誤,指出需要對程序集
參考「System.Data,版本= 2.0.0.0,文化=中性公鑰= b77a5c561934e089' 包含基類的System.Data.Common.DbConnection「添加一個到您的項目。
我證實,我有System.Data在我的參考補充說,其實這個問題可能是由於PRIVATE文件夾中的System.Data.SqlServerCe.dll
版本不正確,它是3.5.1.0(如果我使用在Reference窗口中可用)和3.5.1.50(如果我使用PRIVATE dll)。
下面是我的錯誤之一的代碼。該錯誤出現在SqlCeConnection
中。
Imports System.Data.SqlServerCe
Imports System.Data
Imports System.IO
Module dbConnection
Public databaseConn As SqlCeConnection
Public Function openConn() As SqlCeConnection
If IsNothing(databaseConn) Then
ElseIf databaseConn.State = ConnectionState.Open Then
databaseConn.Close()
End If
databaseConn = New SqlCeConnection("Persist Security Info = False; Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\sanyodb.sdf")
Try
databaseConn.Open()
Catch ex As Exception
MsgBox("Cannot open database", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Error")
End Try
Return databaseConn
End Function
Public conn As New SqlCeConnection("Persist Security Info = False; Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\sanyodb.sdf")
End Module
這是一個智能設備項目,我使用VS 2008,Compact Framework v3.5來進行開發。我使用的編碼語言是VB.NET。
請指教我能做些什麼?實際上,我想要的方法是將我的應用程序部署到設備SD卡上,並確保它即使在硬件重置的情況下仍能正常工作。
謝謝!
問候, 米洛
萬聖節,抱歉,這是我的錯誤,無法正確看待整個事情〜是否有適當的私人指南使用Window Mobile進行部署?恐怕我得到了錯誤的文件或其他東西丟失了。謝謝! :) –
閱讀我的答案... – ErikEJ
對不起,因爲我有點困惑。如果我將它們作爲內容包含在我的項目中,是否意味着駕駛室內的所有必需文件將與應用程序文件夾一起使用?我怎麼知道實際需要哪個駕駛室? –