Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Public Sub issue

$
0
0

Hi, all. 

I'm having an issue with a Public Sub. It's doing exactly what I need it to do, but throwing the general "Catch exception" error message when the form is submitted. Even though it's showing an error, the form is loading into my system as it should. I think it has something to do with my "if" statements. 

    Public Sub updateLEGACY(ByVal strStudtoken As String)
        Using cn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyaidConn").ToString())
            cn.Open()
            Dim cmdinsert As SqlCommand
            If chkLEGACY.checked = True Then
                cmdinsert = New SqlCommand("Update user_string set value_07= 'Y' where student_token = '" & strStudtoken & "' ", cn)
            Else
                cmdinsert = New SqlCommand("Update user_string set value_07= '' where student_token = '" & strStudtoken & "' ", cn)
            End If
            cmdinsert.ExecuteNonQuery()

            cn.Close()
        End Using

    End Sub

If I remove the "If" statements, it works without an error. 

Any guidance?


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>