문제

In my webmethod, i am updating the database. but while debugging the cursor escapes on cmd.ExecuteNonQuery(). my code is,

        If tbl = "All" Then
            cmd = New SqlCommand("update setbool set pos_val='False',valid_rp='False',Pos_save='False'", conn)
            cmd.ExecuteNonQuery()
            Return Nothing
        Else
            cmd = New SqlCommand("update setbool set " & tbl & "='True'", conn)
            cmd.ExecuteNonQuery()
            Return Nothing
        End If

Any suggestion?

도움이 되었습니까?

해결책

I found my own solution.

instead of

        cmd = New SqlCommand("update setbool set pos_val='False',valid_rp='False',Pos_save='False'", conn)
        cmd.ExecuteNonQuery()
        Return Nothing

i changed

            Using cmd1 As New SqlCommand("update setbool set pos_val='False',valid_rp='False',Pos_save='False'")
                cmd1.CommandType = CommandType.Text
                cmd1.Connection = conn
                conn.Open()
                cmd1.ExecuteNonQuery()
                conn.Close()
            End Using
            Return Nothing
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top