Error with DAAB and Enterptise Library 4.0 RRS feed

  • Question

  • User-1862720597 posted


    I'm using VS 2008 with the Microsoft.Parctices.EnterpriseLibrary 4.0. I'm using DAAB and getting an error message in my function.

    Here is the function: 

    Public Function GetSectionIDs(ByVal page_id As Integer, ByVal league_id As Integer, _
                                ByVal season_id As Integer) As ArrayList
            Dim params(2) As SqlParameter
            params(0) = New SqlParameter("@page_id", SqlDbType.Int)
            params(0).Value = page_id
            params(1) = New SqlParameter("@league_id", SqlDbType.Int)
            params(1).Value = league_id
            params(2) = New SqlParameter("@season_id", SqlDbType.Int)
            params(2).Value = season_id
            Dim dr As IDataReader
            Dim myList As New ArrayList
                Dim db = DatabaseFactory.CreateDatabase("ConnectionString")
                dr = db.ExecuteReader("GetSectionIDs", params)
                While dr.Read
                End While
                Return myList
            Catch ex As Exception
            End Try
        End Function

     ...and I get the following error "Failed to convert parameter value from a SqlParameter to a Int32."

    I tried putting hard coded values for my parameter values and getting the same error. It fails on the bolded line.

    Does anyone see the problem here?


    Saturday, October 4, 2008 10:39 AM


All replies