Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is not accessible in this context because it is 'Private'

Status
Not open for further replies.

adalli

Programmer
Joined
Feb 8, 2005
Messages
44
Location
MT
I am creating a datareader from a table residing on an ACCESS 2000 database. Following is the code I am using.

Dim dbConnection As OleDbConnection = New OleDbConnection
dbConnection.ConnectionString = gbConnectionString

Dim myCommand As OleDbCommand = New OleDbCommand
myCommand.Connection = dbConnection
myCommand.CommandText = strSelectStatement

Dim datRead As New OleDbDataReader

Under the datRead I am getting the blue underline stating that "is not accessible in this context because it is 'Private'".

Can any one please advise?

Many thanks in advance
 
Dont put the 'New' on the datareader, just declare it
You then do

datRead = myCommand.ExecuteReader
 
Thanks, that did it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top