Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 31st, 2006, 04:11 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Email Register for Updates

Hi

I am currently studying the Beginning ASP.NET 1.1 with VB.NET 2003 but getting in a muddle one part of the code in Chapter 11, I am getting an error of BC30311: Value of type 'System.Data.IDataReader' cannot be converted to 'Integer'.

Here is the line in question that this is refering to: -

Function CheckEmailAddress(ByVal emailAddress As String) As Boolean


    Dim connectionString As String = _
        ConfigurationSettings.AppSettings("ConnectionStrin g")
    Dim dbConnection As System.Data.IDbConnection = _
        New System.Data.OleDb.OleDbConnection(connectionString )

    Dim queryString As String = "SELECT COUNT([Newsletter].[EmailAddress])" & _
        "FROM [Newsletter] WHERE ([Newsletter].[EmailAddress] = @EmailAddress)"
    Dim dbCommand As System.Data.IDbCommand = _
        New System.Data.OleDb.OleDbCommand
        dbCommand.CommandText = queryString
        dbCommand.Connection = dbConnection

    Dim dbParam_emailAddress As System.Data.IDataParameter = _
        New System.Data.OleDb.OleDbParameter
        dbParam_emailAddress.ParameterName = "@EmailAddress"
        dbParam_emailAddress.Value = emailAddress
        dbParam_emailAddress.DbType = System.Data.DbType.[String]
        dbCommand.Parameters.Add(dbParam_emailAddress)
    Dim Result As Integer = 0

        dbConnection.Open

        Try
            Result = dbCommand.ExecuteReader
        Finally
            dbConnection.Close
        End Try

        If Result > 0 Then
            Return True
        Else
            Return False
        End If

End Function

The line in red is showing the error. Why is this error being generated?

Thanks

Sharon


  #2 (permalink)  
Old October 31st, 2006, 04:17 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. result is an integer.. maybe you where looking for executescalar that only return a value??? execute reader returns a datareader ;)

HTH

Gonzalo
  #3 (permalink)  
Old October 31st, 2006, 04:25 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ahh, many thanks, not sure why this is in the book I am studying wrong then?

Thanks

Sharon
  #4 (permalink)  
Old October 31st, 2006, 04:29 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

could be.. if it is a wrox book look for the errata that's is on the main page.. ;)

HTH

Gonzalo
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updates? GeekyMonkey BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 12 May 24th, 2006 12:11 PM
Check if user is registered for email updates brettdalldorf ASP.NET 1.0 and 1.1 Basics 4 July 8th, 2005 10:01 AM
Handle Email UPdates sanjeet General .NET 0 February 2nd, 2005 05:18 PM
Email Updates from Excel pstaffeld Excel VBA 1 August 20th, 2003 07:09 AM



All times are GMT -4. The time now is 01:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.