ASP.NET Selected Value error

Posted on 2007-07-25
Last Modified: 2013-11-26
I'm getting an error below when I submit.and recurNum hasn't been touched at all.  WHat can I change to put in a "0" when recurNum hasn't been selected?

If recurNum.SelectedValue = Nothing Or recurNum.SelectedValue = 0 Then
                oCom1.Parameters.Add(New SqlParameter("@recurNum", SqlDbType.Int)).Value = 0
                oCom1.Parameters.Add(New SqlParameter("@recurNum", SqlDbType.Int)).Value = recurNum.Text
            End If
Question by:lrbrister
    1 Comment
    LVL 48

    Accepted Solution

    Leave it empty

    If Not recurNum.SelectedValue Is Nothing Or recurNum.SelectedValue <> 0 Then
         oCom1.Parameters.Add(New SqlParameter("@recurNum", SqlDbType.Int)).Value = recurNum.Text
    End If

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Flash ( has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now