5
votes

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?)

2
Your title says the error is about "open" but your text says the error is about "Close" ?Tim
@Tim The problem is Close() missing, I pasted the error message to title. Let me correct it.Bing Lan
Did you invokeClose via IDataReader/DbDataReader or SqlDataReader directly?qxg

2 Answers

3
votes

You should upgrade to RC2 now.

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

0
votes

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