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



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 11th, 2006, 12: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:

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


Code:
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
        Try

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

        Catch ex As Exception

            ' close the connection and rethrow the exception
            connection.Close()
            Throw ex

        End Try

    End Function


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

Code:
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
Reply

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 - 2018, Jelsoft Enterprises Ltd.

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