Last post Apr 15, 2016 03:41 PM by PatriceSc
Apr 15, 2016 12:21 PM|marina_1996|LINK
Error 1 'System.Data.SqlClient.SqlDataReader.Friend Sub New(command As System.Data.SqlClient.SqlCommand, behavior As System.Data.CommandBehavior)' is not accessible in this context because it is 'Friend'. C:\Users\ozdel\Documents\bitirme_odevi\anons.aspx.vb
64 13 C:\...\bitirme_odevi\
How Can I fix it this error?
Apr 15, 2016 03:32 PM|Mikesdotnetting|LINK
You haven't shown the offending code, but most likely you are declaring and trying to "new up" a SqlDataReader e.g.:
Dim reader As New SqlDataReader()
Change that to remove the New:
Dim reader As SqlDataReader()
Apr 15, 2016 03:41 PM|PatriceSc|LINK
To second Mikesdotnetting advice the point is that you never need to create the reader yourself using "new" (which is why the constructor is not publicly available). Instead you call a method such as SqlCommand.ExecuteReader that internally creates the reader
and return this newly created reader to your code.