sir_thursday
sir_thursday

Reputation: 5409

'Object' does not contain a definition for 'GetSqlXml'

Visual Studio is not liking this code. =(

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

It hates the 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?)

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?

Upvotes: 1

Views: 265

Answers (1)

McGarnagle
McGarnagle

Reputation: 102743

You need to provide the column index (the GetSqlXml method belongs to SqlDataReader):

SqlXml sqlXml = reader.GetSqlXml(0);

Upvotes: 7

Related Questions