none
PLEASE HELP ME... THE "CATCH EX AS EXCEPTION" IS THE ERROR HERE...HOW CAN I FIX IT??

    Question

  • Public Function InsertIntoDB(DBMS As DBMSClass, Commit As Boolean) As Boolean
            Try

                'first generate the sql command
                Dim SQL As String
                SQL = "insert into books (" & _
                        "BookID, " & _
                        "BookTitle, " & _
                        "BookAuthor, " & _
                        "PublicationYear, " & _
                        "Press, " & _
                        "Subject, " & _
                        "Keywords, " & _
                        "AvailableCopies, " & _
                        "TotalCopies, " & _
                        "ShelfNo, " & _
                        "Barcode, " & _
                        ") values (@0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10)"

                DBMS.ExecuteSQL(SQL, _
                               Me.BookID, _
                               Me.BookTitle, _
                               Me.BookAuthor, _
                               Me.PublicationYear, _
                               Me.Press, _
                               Me.Subject, _
                               Me.Keywords, _
                               Me.AvailableCopies, _
                               Me.TotalCopies, _
                               Me.ShelfNo, _
                               Me.Barcode)

                'save the changes
                If Commit Then
                    DBMS.Commit()
                End If



                'set old = new
                Me.OldBookID = Me.BookID
                Me.OldBookTitle = Me.BookTitle
                Me.OldBookAuthor = Me.BookAuthor
                Me.OldPublicationYear = Me.PublicationYear
                Me.OldPress = Me.Press
                Me.OldSubject = Me.Subject
                Me.OldKeywords = Me.Keywords
                Me.OldAvailableCopies = Me.AvailableCopies
                Me.OldTotalCopies = Me.TotalCopies
                Me.OldShelfNo = Me.ShelfNo
                Me.OldBarcode = Me.Barcode


                Return True
            Catch ex As Exception
                DBMS.Rollback()
                Return False
            End Try

    Wednesday, January 27, 2016 6:46 AM

All replies

  • THE "CATCH EX AS EXCEPTION" IS THE ERROR HERE

    The code "Catch ex As Exception" compiles just fine.

    So it threw an exception.  What were the details of the exception?

    Wednesday, March 2, 2016 5:06 PM