[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

ASP.NET Selected Value error

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
            Else
                oCom1.Parameters.Add(New SqlParameter("@recurNum", SqlDbType.Int)).Value = recurNum.Text
            End If
0
lrbrister
Asked:
lrbrister
1 Solution
 
jpaulinoCommented:
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
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now