Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Vote for DotNetNuke as your choice for winner of this year's PackT Open Source CMS Award
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
The best choice for your web site host, email hosting, and domain registration.
 


  Sponsors  

Meet Our Sponsors

WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
CrystalTech Web Hosting™
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Frustrating Error
Previous Previous
 
Next Next
New Post 12/11/2006 10:45 AM
User is offline Steve Wyatt
4 posts
10th Ranked


Frustrating Error 

Hi all, I'm getting the following error:

Value of type 'System.collections.Arraylist' cannot be converted to 'SPC.Modules.IRISCreativeServices.T_CSJobCodesInfo'

The error occurs on the 2nd line below:


Dim IRISJobCodeCtrl As New T_CSJobCodesController

 

Dim IRISJCInfo As T_CSJobCodesInfo = IRISJobCodeCtrl.GetAll(ModuleId)

I have another similar object that works just find and have compared the two and can't see any difference.  I've listed the components below, can someone please shed some light on this?

From the Dataprovider:
Public MustOverride Function T_CSJobCodesGetAll(ByVal ModID As Integer) As IDataReader

From the SQLDataProvider:
Public Overrides Function T_CSJobCodesGetAll(ByVal ModID As Integer) As IDataReader
 Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "spCSJobCodesGetAll", ModID), IDataReader)
End Function

From the Info class:
    Public Class T_CSJobCodesInfo
        ' Entity member variables for database table T_CSJobCodes
        Private mJobCodesID As Integer
        Private mJobCode As String
        Private mModuleID As Integer

        ' Calculated Expression member variables for database table T_CSJobCodes

        ' Entity properties for database table T_CSJobCodes
        Public Property JobCodesID() As Integer
            Get
                Return mJobCodesID
            End Get
            Set(ByVal Value As Integer)
                mJobCodesID = Value
            End Set
        End Property

        Public Property JobCode() As String
            Get
                Return mJobCode
            End Get
            Set(ByVal Value As String)
                mJobCode = Value
            End Set
        End Property
        Public Property ModuleID() As Integer
            Get
                Return mModuleID
            End Get
            Set(ByVal Value As Integer)
                mModuleID = Value
            End Set


From the Controller:
        Public Function GetAll(ByVal ModID As Integer) As ArrayList
            Dim infoList As ArrayList = Nothing
            Dim idr As IDataReader = Nothing
            Try
                idr = DataProvider.Instance().T_CSJobCodesGetAll(ModID)
                infoList = CBO.FillCollection(idr, GetType(T_CSJobCodesInfo))
            Finally
                If Not idr Is Nothing Then
                    idr.Close()
                    idr.Dispose()
                    idr = Nothing
                End If
            End Try
            Return infoList
        End Function


Stored Procedure:
CREATE PROCEDURE [IRIS_User].[DNN_spCSJobCodesGetAll]
  @ModID int
 AS
 SET NOCOUNT ON
 SELECT JobCodesID,JobCode,ModuleID FROM IRIS_User.DNN_T_CSJobCodes WHERE ModuleID=@ModID

 

       

 
New Post 12/11/2006 3:09 PM
User is offline William Severance
744 posts
www.wesnetdesigns.com
7th Ranked






Re: Frustrating Error 

Note that IRISJobCodeCtrl.GetAll(ModuleId) returns an ArrayList of T_CSJobCodesInfo objects, not a single T_CSJobCodesInfo object. You will then need to iterate through the ArrayList to process each object or bind to a databound list control, etc. Something like this:

Dim IRISJCs As ArrayList = IRISJobCodeCtrl.GetAll(ModuleId)

For Each obj As T_CSJobCodesInfo in IRISJCs

        ' process each object

Next


Bill, WESNet Designs
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Frustrating Error
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Softech Development, Inc.
We help your business work smarter with DotNetNuke. Whether you need a new implementation, a custom module or skin for an existing implementation, or integration with your business processes, Softech has the experience and expertise to make it happen.
www.softechdevelopment.com
Module Development by Engage Software
Specializing in custom module development, training and skinning.
www.engagesoftware.com
BataviaSoft DotNetNuke Solutions
BataviaSoft offers custom DotNetNuke solutions especially for the European and the South East Asian market.
www.bataviasoft.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP