Print Page | Close Window

Needs Help With a Typo

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=16527
Printed Date: 29 March 2026 at 4:24am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Needs Help With a Typo
Posted By: Misty
Subject: Needs Help With a Typo
Date Posted: 12 September 2005 at 4:12pm
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:

Code:
        '---------------------------------------------------------------- 
        ' 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.



Replies:
Posted By: Mart
Date Posted: 12 September 2005 at 4:33pm
    Dim dtrCounty As System.Data.SqlClient.SqlDataReader

will definatley work


Posted By: Misty
Date Posted: 13 September 2005 at 1:53am
Thank you! I also found out that I had accidentally changed something in the name space at the top of my ASP.Net file. I had accidentally changed this information when I replaced a certain word with something for everything else. I was just not supposed to change the word in the name space. Wink



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net