在我的db表格布局中,有一列的类型是hierarchyid (列索引= 4)。 当试图设置新的环境(一个虚拟的Web服务器,由XEN服务器创建),然后运行该网站,我遇到了这个问题:
异常消息:DataReader.GetFieldType(4)返回null。 异常数据:System.Collections.ListDictionaryInternal
我做了一些搜索,发现已经有一些话题了(比如在MSDN上 )。
但即使当我添加C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll库时,似乎结构SqlHierarchyId中的db类型也不会被识别。
“DataReader.GetFieldType异常(4)返回null”仍然被抛出。
注意:如果我将VS2010中的C#包安装到环境(Windows Server 2008 RC2)上,但是我的老板不接受这个问题,因为这纯粹是一个简单的Web服务器。
In my db table Layout, there's one column whose type is hierarchyid (column index=4). When trying to set-up new environment (a virtual web-server, created from XEN server), then running the site, I've met with this issue:
Exception message: DataReader.GetFieldType(4) returned null. Exception data: System.Collections.ListDictionaryInternal
I've made some search and found out there are already some topic on it (such as on MSDN).
But even when I added the C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll library, it seems like db type in structure SqlHierarchyId doesn't get recognized.
"Exception at DataReader.GetFieldType(4) returned null" is still thrown out.
Note: The issue will be solved if I made installation of C# package in VS2010 onto the environment (Windows Server 2008 RC2), but my boss didn't accept that, because this is purely a simple web-server.
最满意答案
引用项目中的Microsoft.SQLServer.Types dll,并将其引用为参考的属性中的“Copy Local”。 这将在您部署它时将该DLL与网站一起打包。 然后,您不需要在Web框中安装所有SQL Server以使用SQL Server数据类型。 我为我的网站做了这个,因为它使用的是geography数据类型的列,我得到了同样的错误。
Reference the Microsoft.SQLServer.Types dll from the project and for the reference set it as "Copy Local" in the properties of the reference. This will package that DLL up with the website when you deploy it. Then you don't need all of SQL Server installed on your web box in order to use the SQL Server data types. I did this for my website because it was using the geography data type columns and I was getting the same error.
更多推荐
发布评论