本文介绍了如何在应用程序执行期间保存异常错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
请帮助我此异常错误消息&保存到数据库.
这是我的代码.

Hi.
Please help me this exception error message & save to DB.
Here''s my code..

Try
          .....
        Catch ex As Exception
            MsgBox(ex.Message,MsgBoxStyle.OkOnly,My.Application.Info.Title)
            ErrorLog(ex.Message.ToString, "Error Found in Delete Button.",Me.Text)
End Try



这是我的ErrorLog Function()



And here''s my ErrorLog Function()

Public Sub ErrorLog(ByVal strMessage As String, ByVal strCommand As String, ByVal strFormName As String)
        Try
            Dim strINSERT As String = "INSERT INTO tblerrorlog(username, tdate, ttime,errorlog, errorcommand,formname) " _
                   & " VALUES(''" & P_username & "'',''" & P_ServerDate & "'',''" & P_ServerTime & "'', " _
                   & " ''" & strMessage & "'',''" & strCommand & "'',''" & strFormName & "'') "
            Try
                Dim DReader As New DataClassReader
                DReader.strSaveUpdateSQL = strINSERT
                ''DReader.PinoyDataReader.Close()
                DReader.DataUpdate()
            Catch ex As MySqlException
                MsgBox(ex.Message, MsgBoxStyle.OkOnly, My.Application.Info.Title)
            End Try
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly, My.Application.Info.Title)
        End Try
    End Sub



问题是我无法获得异常错误.
我知道我的代码在正确的轨道上,但是它不起作用.
请帮忙.



The problem is I can''t get the exception error.
I know my code is on the right track, but it isn''t working.
Please help.

推荐答案

jleonorlane写道:
jleonorlane wrote:

问题是我无法获取异常错误.

The problem is I can''t get the exception error.



解释一下.发生了什么事?



Explain this. What is happening?


这篇关于如何在应用程序执行期间保存异常错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 12:22