【发布时间】:2011-02-11 04:15:08
【问题描述】:
我目前正在将一个 VBA XML 阅读器重写为一个项目的 VB.net 版本。我在 VBA 中有以下代码:
Dim XML_Doc As Object: Set XML_Doc = CreateObject("MSXML2.DOMDocument")
Dim XML_Detail As New ADODB.Recordset: XML_Detail.ActiveConnection =
"Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
有人告诉我,我应该能够在我的 VB.Net 版本中使用几乎完全相同的代码,但我遇到了一些问题。我添加了 Microsoft ActiveX 2.8 作为对 VB.net 项目的引用,因此我可以使用 ADODB。
VB.Net中的代码是
Dim XmlDoc As Object : XmlDoc = CreateObject("MSXML2.DOMDocument")
Dim XmlDetail As New ADODB.Recordset : XmlDetail.ActiveConnection =
"Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
运行应用程序时,它会到达 XmlDetail 并引发以下错误:
System.Runtime.InteropServices.COMException was unhandled.
Arguments are of the wrong type, are out of acceptable range,
or are in conflict with one another.
有没有人有这方面的经验或者我该如何解决?
谢谢
【问题讨论】: