Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

VB.NET SQL Query for deletion not executed

I'm dealing with an odd issue, no one in my team was able to help me.

I've created a web service to delete content from a table. When I run this function from SOAP Center, everything is fine, values are deleted.

As soon as I call this function from my application, it is not working and nothing happen. I don't have any error and I tried to put return value to catch any error and nothing.

Can someone explain the difference in the execution if the issue come from this ?

Function in the WS

Public Function DELETE_VALUES() As Integer
    Dim db2Transaction As MsDb2Transaction
    Dim db2Command As MsDb2Command
    Dim oracleCommand As OracleCommand

    Using db2Connection As New MsDb2Connection(myConnectionString)
        Try
            db2Connection.Open()
            db2Transaction = db2Connection.BeginTransaction

            Dim sSqlDelete As String = String.Empty
            sSqlDelete += "DELETE FROM TABLE_DB2 "
            sSqlDelete += "WHERE ACTIVE = 'Y' "
            db2Command.Transaction = db2Transaction
            db2Command.ExecuteNonQuery()
            ' Commit needed on our DB2 DB
            db2Transaction.Commit()
        Catch ex As MsDb2Exception
            db2Connection.Close()
            Return 8
        Finally
            db2Connection.Close()
        End Try
    End Using

    Using oracleConnection As New OracleConnection(myConnectionStringOracle)
        Try
            oracleConnection.Open()

            Dim sSqlDelete As String = String.Empty
            sSqlDelete += "DELETE FROM TABLE_ORACLE "
            sSqlDelete += "WHERE ACTIVE = 'Y' "
            oracleCommand.ExecuteNonQuery()
            ' Commit is automatic on Oracle
        Catch ex As MsDb2Exception
            oracleConnection.Close()
            Return 9
        Finally
            oracleConnection.Close()
        End Try
    End Using

    Return 0
End Function

Function from my application

Public Function ValuesTreatment() As Integer
    WS_Functions.DELETE_VALUES()
    
    ' The rest of this function will add recent values
End Function
question from:https://stackoverflow.com/questions/66065107/vb-net-sql-query-for-deletion-not-executed

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...