DBNull to type Integer is not valid error message RRS feed

  • Question

  • User593260253 posted

    I have just loaded up the club website to my hosting server and am getting this error message when I click on the "View all Events" on the default.aspx page:  

    Conversion from type 'DBNull' to type 'Integer' is not valid.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Integer' is not valid.

    Source Error:

    Line 9:      Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
    Line 10:         Dim pages As Integer
    Line 11:         pages = CInt(e.Command.Parameters("@pageCount").Value)
    Line 12:         pn1.Count = pages
    Line 13:         pn2.Count = pages

    Being a Newbie, I am assuming that this is referring to the dataype in the events table of the sql database.  I tried changing the "null" to "not null" for the integer columns but still get the same error message.  I read numerous messages in the archives addressing dbnull issues (i.e., dbnull to string) but didn't see anything about dbnull to integer problems.  Any help sorting this out would be greatly appreciated.

    Monday, October 9, 2006 10:44 PM

All replies