?
Solved

How to bypass an exception error that occurs in Oracle when invoked through ASP.net code

Posted on 2006-03-30
1
Medium Priority
?
335 Views
Last Modified: 2010-10-05
I have a program that reads a oracle table and parse the data into various sub tables

The problem i am facing is that when an error occurs while tranforming the data to the sub tables, i need the program to continue processing the remainder of the records . How do i do implement this.

Here is a code i use to insert to sub tables.  When an error occurs while inserting a record to this table, i need it to continue on....

 Public Sub InsertDiversity(ByVal lEngagementID As Long, ByVal sScopeDiversity As String)

        Dim oDataAccess As New DataAccess, oReader As OracleDataReader
        Dim sSQL, sSQLQuery As String
        Dim lSeqID As Long
        Try
            lSeqID = oDataAccess.ExecuteInsertReturnKeyByRef("ENGAGEMENT_DIVERSITY_ID_SEQ")
            sSQL = "INSERT INTO DIVERSITY   ( ENGAGEMENT_DIVERSITY_ID ,ENGAGEMENT_ID,DIVERSITY_LIST,CREATE_DATE ) " & _
                           "VALUES(" & lSeqID & "," & lEngagementID & ",'" & oGeneric.clearSingleQuote(sScopeDiversity) & "', sysdate )"
            '  sSQLQuery = "INSERT INTO ENGAGEMENT_DIVERSITY_SQL   ( ID,SQLQUERY) VALUES( " & lSeqID & ",'" & sSQL & "')"
            ' oDataAccess.ExecuteNonQuery(sSQLQuery)
            AddtoFile(sSQL, "Diversity.txt")
            oDataAccess.ExecuteNonQuery(sSQL)
        Finally


            oDataAccess.Close()


        End Try



    End Sub
0
Comment
Question by:GSK_DEV
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 16330797
You mean it throws the exception still ?

If so, just add an empty Catch block.

        Dim oDataAccess As New DataAccess, oReader As OracleDataReader
        Dim sSQL, sSQLQuery As String
        Dim lSeqID As Long
        Try
            lSeqID = oDataAccess.ExecuteInsertReturnKeyByRef("ENGAGEMENT_DIVERSITY_ID_SEQ")
            sSQL = "INSERT INTO DIVERSITY   ( ENGAGEMENT_DIVERSITY_ID ,ENGAGEMENT_ID,DIVERSITY_LIST,CREATE_DATE ) " & _
                           "VALUES(" & lSeqID & "," & lEngagementID & ",'" & oGeneric.clearSingleQuote(sScopeDiversity) & "', sysdate )"
            '  sSQLQuery = "INSERT INTO ENGAGEMENT_DIVERSITY_SQL   ( ID,SQLQUERY) VALUES( " & lSeqID & ",'" & sSQL & "')"
            ' oDataAccess.ExecuteNonQuery(sSQLQuery)
            AddtoFile(sSQL, "Diversity.txt")
            oDataAccess.ExecuteNonQuery(sSQL)
        Catch
            '// Don't do anything
        Finally

            oDataAccess.Close()

        End Try
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 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