0
我想通過使用MS Excel宏的幫助將數據插入到創建「test.SDF」數據庫文件表的SQLCE中。我不想將我的Excel文件轉換爲.SDF,但想要使用宏從我的Excel文件插入數據到SDF。使用宏連接到SQL精簡版
到現在我已經做到了這一點
Dim strconn As String
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command
strconn = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source= H:\Excel files and Macros\TechData.sdf;Persist Security Info=False;"
Set cmd = New ADODB.Command
Set cnt = New ADODB.Connection
cnt.ConnectionString = strconn
cnt.Open
Runsql ("Insert into UnitData Values(" & Version & ", " & Acoustic & ")")
cnt.Close
我對着下面的錯誤「錯誤3706:無法執行提供商,它可能不是 正確安裝。」
在行「cnt.Open」 我還添加了引用「微軟的ActiveX」數據對象2.0庫
感謝您的幫助和有關問題的任何進一步的間隙請評論。
你試過了什麼?谷歌有很多這方面的例子 - 你是否嘗試過使用其中之一? –
我試過了下面的代碼。 – Rahul
您是否安裝了SQLCE 3.5 SP2 MSI? – ErikEJ