ADODBC无法从程序集中加载类型'ADODB.FieldsToInternalFieldsMarshaler' [英] ADODBCould not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly
问题描述
我正在尝试读取这样的ADOBD.Recordset对象(这是我的第一次,所以请原谅我的笨拙:D):
I'm trying to read an ADOBD.Recordset object like this (my first time, so pardon my "noobness" :D):
Presentation.Category categorySvc = new Presentation.Category();
ADODB.Recordset categories = categorySvc.ListAll("BE", "DUE", "EN", 128);
foreach (var category in categories.Fields) // here is where I get the exception
{
// ...
}
ListAll调用可以正常工作-我得到了带有一些数据的Recordset,通过对对象执行QuickWatch可以确认这一点。但是当代码到达category.Fields时,出现以下异常:
The ListAll call works fine - I get the Recordset with some data which I confirm that by doing a QuickWatch on the object. But when the code reach the categories.Fields I get the following exception:
无法加载类型
'ADODB.FieldsToInternalFieldsMarshaler'
来自程序集'TestCOMCalls,
Version = 1.0.0.0,Culture = neutral,
PublicKeyToken = null'。
Could not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly 'TestCOMCalls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
我在这个错误上进行了搜索(或者只是通过'ADODB.FieldsToInternalFieldsMarshaler'进行了搜索,找不到任何对我有帮助的问题)。
I googled this error (or just by 'ADODB.FieldsToInternalFieldsMarshaler' and couldn't find anything that would help me with issue).
我想知道,我缺少参考吗?除了正常引用外,我还将此项目添加到了我的项目中:
I wonder, am I missing a reference? Besides the normal references I have added this one to my project:
ADODB
Microsoft ActiveX数据对象2.5库
C:\WINDOWS\assembly\GAC\ADODB\7.0.3300.0__b03f5f7f11d50a3a\ADODB.dll
ADODB Microsoft ActiveX Data Objects 2.5 Library C:\WINDOWS\assembly\GAC\ADODB\7.0.3300.0__b03f5f7f11d50a3a\ADODB.dll
就像我说,我之前从未做过,但是通过谷歌搜索我可以看到一些人正在这样做(在object.Fields上进行foreach),它似乎对他们有用。
Like I said, I've never done this before but by googling a bit I was able to see some people doing this (foreach on the object.Fields) and it seem to work for them.
非常感谢您的帮助或指导:)
Any help or direction is greatly appreciated :)
谢谢!
推荐答案
好的,我想出了如何做到这一点:
Okay, I figured how to do this:
Presentation.Category categorySvc = new Presentation.Category();
ADODB.Recordset categories = categorySvc.ListAll("BE", "DUE", "EN", 128);
categories.MoveFirst();
while(!categories.EOF)
{
var fields = ((dynamic)categories).Fields;
for (int i = 0; i < fields.Count; i++)
{
var field = fields[i];
var name = field.Name;
var value = field.Value;
// ...
}
categories.MoveNext();
}
这篇关于ADODBC无法从程序集中加载类型'ADODB.FieldsToInternalFieldsMarshaler'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!