Bing Lan
Bing Lan

Reputation: 1131

DNX Core 5.0 error CS1061: 'SqlDataReader' does not contain a definition for 'Close'

I managed to install System.Data.SqlClient from Nuget and I can use SqlConnection and SqlDataReader to read. But why error says Close() for SqlDataReader missing for DNX core 5?

DNX Core 5.0 error CS1061: 'SqlDataReader' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'SqlDataReader' could be found (are you missing a using directive or an assembly reference?)

Upvotes: 5

Views: 1080

Answers (2)

Lex Li
Lex Li

Reputation: 63173

You should upgrade to RC2 now.

Such Close methods have been removed in many types, and you should call Dispose in most cases instead.

Upvotes: 3

Tim
Tim

Reputation: 15237

I'm not positive this is the right version of SqlDataReader, but it looks like in the corefx version of SqlDataReader, the Close method is internal rather than public like in the full .NET framework

corefx's SqlDataReader.cs

Upvotes: 0

Related Questions