ASP Development
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Remember me

Go Back   Dev Articles Community ForumsProgrammingASP Development

Add This Thread To:   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
Unread Dev Articles Community Forums Sponsor:
Old September 11th, 2006, 01:24 PM
winkz winkz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
Join Date: Aug 2006
Posts: 2 winkz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 29 sec
Reputation Power: 0
ASP.NET 2.0 help converting issue

I have create a class called OrderInfo as follows:

Public Class OrderInfo

    Public OrderID As String
    Public TotalAmount As Decimal
    Public DateCreated As String
    Public DateShipped As String
    Public Verified As Boolean
    Public Completed As Boolean
    Public Canceled As Boolean
    Public Comments As String
    Public CustomerName As String
    Public ShippingAddress As String
    Public CustomerEmail As String

End Class

I have a function called GetOrderDetails as follows:

Public Shared Function GetOrderDetails(ByVal orderId As String) As SqlDataReader

        ' create the connection object
        Dim connection As New SqlConnection("connectionString")
        ' create and initialize command object
        Dim command As New SqlCommand("GetOrderDetails", connection)
        command.CommandType = CommandType.StoredProcedure

        ' add an input parameter and supply a value for it
        command.Parameters.Add("@OrderID", SqlDbType.SmallInt)
        command.Parameters("@OrderID").Value = orderId

        ' return the results

            ' open the connection
            'return the SqlDataReader to the calling function
            Return command.ExecuteReader(CommandBehavior.CloseConnect  ion)

        Catch ex As Exception

            ' close the connection and rethrow the exception
            Throw ex

        End Try

    End Function

I have a subprocedure called PopulateControls with the following code included:

dim orderInfo as new OrderInfo
orderInfo = OrderManager.GetOrderDetails(orderId)

I receive an error on the highlighted line.

"Value of type 'System.Data.SqlClient.SqlDataReader' cannot be converted to 'OrderInfo'.

This code worked fine in ASP.NET 1.1 ... but I receive the error in 2.0 ....

Any Suggestions?

Reply With Quote

Viewing: Dev Articles Community ForumsProgrammingASP Development > ASP.NET 2.0 help converting issue

Developer Shed Advertisers and Affiliates

Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.

© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap