0
我試圖用以下連接字符串連接到SQL Server Compact Edition .sdf文件;SQLSERVER.CE.OLEDB.3.5連接多步OLEDB錯誤
connMRC.ConnectionString = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=" & App.Path & "\Freeweigh.sdf;"
我收到以下錯誤每次我嘗試運行SQL命令或打開一個記錄:
多步OLE DB生成的錯誤。檢查每個OLE DB狀態值(如果可用)。沒有工作完成。
我使用VB 6.0和SQL Server Compact 3.5 SP2
下面的代碼:
Public Sub opnConnectionC()
'Code for opening the ADO Connection
chkConn = connMRC.State
If chkConn = adStateClosed Then
connMRC.ConnectionString = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=" & App.Path & "\Freeweigh.sdf;"
connMRC.Open
End If
End Sub
Public Sub opnRecordsetC(rsOpen As Recordset)
'Code for opening the ADO Recordset
chkRs = rsOpen.State
If chkRs = adStateClosed Then
rsOpen.Source = strSQLC
rsOpen.CursorType = adOpenDynamic
rsOpen.LockType = adLockOptimistic
rsOpen.ActiveConnection = connMRC
rsOpen.Open
End If
End Sub
Private Sub tmrUpload_Timer()
Dim cmdUpload As New ADODB.Command
Dim rsFetch As New ADODB.Recordset
Call opnConnectionC
strSQLC = "SELECT Product FROM VehicleWeights"
Call opnRecordsetC(rsFetch)
rsFetch.MoveFirst
MsgBox (rsFetch.Fields("Product").Value)
Call clsConnectionC
End Sub
並非所有ADO操作是可能的,但請分享一些代碼 – ErikEJ
剛剛更新與相關代碼的問題。請看看 – theNemesiz