Can someone please help me to fix the following error message in my code:
Compiler Error Message: BC30390: 'System.Data.SqlClient.SqlDataReader.Private Sub New(command As System.Data.SqlClient.SqlCommand)' is not accessible in this context because it is 'Private'.
Source Error:
|
Line 19: Dim conCounty As New System.Data.SqlClient.SQLConnection
Line 20: Dim cmdSelect As New System.Data.SqlClient.SQLCommand
Line 21: Dim dtrCounty As New System.Data.SqlClient.SqlDataReader
|
Here's my code:
Let me give you all of my code for that particular data list:
'----------------------------------------------------------------
' name: BindCountyList()
'----------------------------------------------------------------
Sub BindCountyList()
Dim strConnect As String
Dim conCounty As New System.Data.SqlClient.SQLConnection
Dim cmdSelect As New System.Data.SqlClient.SQLCommand
Dim dtrCounty As New System.Data.SqlClient.SqlDataReader
'Get connection string from Web.Config
strConnect = ConfigurationSettings.AppSettings("ConnectionString")
conCounty = New System.Data.SqlClient.SQLConnection(strConnect)
conCounty.Open()
cmdSelect = New System.Data.SqlClient.SQLCommand( "Select CountyID, County From County Order by County", conCounty)
dtrCounty = cmdSelect.ExecuteReader()
dropCounty.DataSource = dtrCounty
dropCounty.DataValueField = "CountyID"
dropCounty.DataTextField = "County"
dropCounty.DataBind()
'Add and select a "Select County" option for the DDL
dropCounty.Items.Insert(0, new ListItem("Select County", ""))
dropCounty.SelectedIndex = 0
dtrCounty.Close()
conCounty.Close()
End Sub
When I used Dim dtrCounty As SqlDataReader instead of Dim dtrCounty As New System.Data.SqlClient.SqlDataReader, I got the error message below:
Compiler Error Message: BC30002: Type 'SqlDataReader' is not defined.
Edited by Misty - 12 September 2005 at 4:12pm