Visual Studio is not liking this code. =(
Visual Studio不喜欢这个代码。=(
SqlXml sqlXml = reader["ScenarioData"].GetSqlXml();
It hates the GetSqlXml();
part, and is throwing the error:
它讨厌GetSqlXml();部分,并抛出错误:
'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?)
'object'不包含'GetSqlXml'的定义,也没有找到接受'object'类型的第一个参数的扩展方法'GetSqlXml'(您是否缺少使用指令或程序集引用?)
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. What are my next steps?
我想我已经包含了所有必要的引用、名称空间和dll文件,但是我不能让VS识别这个函数。我的下一步是什么?
1 个解决方案
#1
7
You need to provide the column index (the GetSqlXml
method belongs to SqlDataReader):
需要提供列索引(GetSqlXml方法属于SqlDataReader):
SqlXml sqlXml = reader.GetSqlXml(0);
#1
7
You need to provide the column index (the GetSqlXml
method belongs to SqlDataReader):
需要提供列索引(GetSqlXml方法属于SqlDataReader):
SqlXml sqlXml = reader.GetSqlXml(0);