Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2005, 12:47 PM
Registered User
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to erikkl2000
Default I need to get my object

Hello,

I am tring to return a employee object to my GUI Page from a dataaccess page. Every thing seems to do fine until the function try's to return the employee object from the Ordional Postion of (0) from the EmployeeList Innerlist. I am getting stuck on the GET and the Return CType(Me.Item(index), Employee) . Wehn i step into the code It just goes back and forth like it is stuck or something. Like a broken record.. And when i just run the application i get an error message that there is a overflow error.

Can someone please look at this and let me know where i need to make chages?

I can post all of the code if i need to..


Thanks,
Erik,..


If you will look below; this is where i am tring to return the employee object

  Default Public ReadOnly Property Item(ByVal index As Int32) As Employee
        Get < ******Stuck here********
            Return CType(Me.Item(index), Employee) < ***** AND HERE




Gui....................................

Dim EmpAss As New EmployeeAccess
ddl.DataSource = EmpAss.PopEmployee(2)
ddl.DataBind()

------------------------------------------------------------
DataAccess-----------------


Public Function PopEmployee(ByVal Empid As Int32) As Employee

        PopEmployee = GenericDataAccess("Employee_Byid", "@Employeeid", Empid)

    End Function
    '
    '
    Dim Emp_Data_List As New EmployeeCollections
    Private Function GenericDataAccess(ByVal CommandText As String, _
                                       ByVal ParamName As String, _
                                       ByVal ParamValue As String) As Employee

        With Data_Connection
            .Open()
        End With
        '
        With Data_Command
            .CommandText = CommandText
            .CommandType = CommandType.StoredProcedure
            With Data_Command.Parameters
                .Add(ParamName, SqlDbType.Int, 4).Value = ParamValue
            End With
            .Connection = Data_Connection
        End With
        '
        Data_Reader = Data_Command.ExecuteReader


        While Data_Reader.Read
            Emp_Data_List.Add(New Employee(Data_Reader("FirstName"), _
                                           Data_Reader("LastName"), _
                                           Data_Reader("City"), _
                                           Data_Reader("Employeeid")))
        End While


        With Data_Connection
            .Close()
        End With
        '
        With Data_Reader
            .Close()
        End With
        '
        With Data_Command
            .Dispose()
        End With
        '
        Return Emp_Data_List(0)
        '
        '
    End Function
================================================== =
CollectionBase---------------------------------

Public Class EmployeeCollections : Inherits CollectionBase



    Public Function Add(ByVal Employee As Employee) As Int32
        Return Me.InnerList.Add(Employee)
    End Function
    '
    Default Public ReadOnly Property Item(ByVal index As Int32) As Employee
        Get
            Return CType(Me.Item(index), Employee)
        End Get
    End Property
End Class






Similar Threads
Thread Thread Starter Forum Replies Last Post
object reference not set to instant of an object shahidrasul ASP.NET 2.0 Basics 1 September 5th, 2008 02:01 PM
Serializing Object Graph - Assigning Object to Jag venkat.kl C# 0 August 28th, 2006 10:39 AM
create a Line object ,Box object in CR at Runtime? thanhnt Pro VB 6 1 May 16th, 2005 06:51 AM
Error Occurred creating Report Object: Object does sa_moizatyahoo Classic ASP Professional 0 February 1st, 2005 10:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.