Program creating class using SQLDataReader [Resolved]
Hey Guys,
I am trying to create a class that makes use of the SQL DataReader but I keep getting this error:
'system.data.sqlclient.sqldatareader.private sub new(command as system.data.sqlclient.sqlcommand') is not accessibe in this context becase it is 'private'
Here is the declarations for my class where I am getting this error the line in question is
dim mySQLRead as new SqlDataReader
Code:
Public Class SQLDatabase
Dim mySQLConnection As New SQLConnection
Dim mySQLCommand As New SQLCommand
Dim mySQLDataAdpater As New SqlDataAdapter
Dim mySQLRead As New SqlDataReader
End Class
Re: Program creating class using SQLDataReader
That's because you are attempting to create an instance of the data reader, and in order to do so, you have to pass it the command object.
There is no option to create new SQLDataReader w/o any parameters.
Try just Dim mySQLRead as SQLDataReader, only create a new instance once you are actualy ready for it.
Tg
Re: Program creating class using SQLDataReader [resolved]