简体   繁体   English

“对象”不包含“ GetSqlXml”的定义

[英]'Object' does not contain a definition for 'GetSqlXml'

Visual Studio is not liking this code. Visual Studio不喜欢此代码。 =( =(

SqlXml sqlXml = reader["ScenarioData"].GetSqlXml();

It hates the GetSqlXml(); 它讨厌GetSqlXml(); part, and is throwing the error: 部分,并抛出错误:

'object' does not contain a definition for 'GetSqlXml' and no extension method 'GetSqlXml' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) “对象”不包含“ GetSqlXml”的定义,并且找不到找到接受“对象”类型的第一个参数的扩展方法“ GetSqlXml”(您是否缺少using指令或程序集引用?)

I think I'm including all of the necessary references and namespaces and dll files but I just can't get VS to recognize the function. 我认为我包括了所有必要的引用,名称空间和dll文件,但我无法让VS来识别该功能。 What are my next steps? 我下一步要做什么?

您需要提供列索引( GetSqlXml方法属于SqlDataReader ):

SqlXml sqlXml = reader.GetSqlXml(0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM