最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
vb.net寫入日志 vbnet recordset

請教高手,如何用vb實現(xiàn)“使用日志”?

很多種方法,最常用的一是用文本文件或數(shù)據(jù)庫記錄,二是調(diào)用API函數(shù)直接寫入系統(tǒng)日志或應(yīng)用程序日志

成都創(chuàng)新互聯(lián)主營定安網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,app開發(fā)定制,定安h5小程序設(shè)計搭建,定安網(wǎng)站營銷推廣歡迎定安等地區(qū)企業(yè)咨詢

在vb.net 中,記錄系統(tǒng)錯誤日志這個功能怎么實現(xiàn)

Public Sub ShowError(strModule As String, strProcedure As String, lngErrorNumber As Long, strErrorDescription As String, showMsg As String)

'

'錯誤處理中心過程,寫數(shù)據(jù)庫日志表或?qū)懭罩疚募?/p>

'

'strModule '模塊名稱

'strProcedure '過程名稱

'lngErrorNumber '錯誤ID號

'strErrorDescription '錯誤描述

'showMsg '是否顯示本過程內(nèi)錯誤顯示信息(值:"Y" or "N")

'Error表結(jié)構(gòu)(f001 (Date)發(fā)生時間, f002 (nvarchar50)模塊名稱, f003 (nvarchar50)過程名稱, f004 (nvarchar50)錯誤ID號, _

f005 (nvarchar300)錯誤描述,f006 (nvarchar50)版 本 號, f007 (nvarchar50)用戶名稱, f008 (nvarchar50)網(wǎng)卡地址

'ErrorCode表結(jié)構(gòu) f001 (nvarchar20)錯誤代碼, f002 (nvarchar255)錯誤信息, f003 (numeric9)錯誤級別

' 級別說明: '10'以下,一般錯誤,不影響操作

' '11-20',嚴(yán)重錯誤,不能操作,程序執(zhí)行退出

On Error GoTo ErrorHandle

Dim strMessage As String

Dim strCaption As String

Dim sVer As String

Dim intLogFile As Integer

Dim Res As New ADODB.Recordset

Dim ResErrorCode As New ADODB.Recordset

Dim strSQL As String

'對應(yīng)錯誤號,從ErrorCode表中找到對應(yīng)的錯誤信息,0-1000 錯誤號保留給VB

DBOpen ResErrorCode, "select * from errorcode where f001='" lngErrorNumber "'"

If Not (ResErrorCode.EOF Or ResErrorCode.BOF) Then

strMessage = ResErrorCode.Fields("f002")

If ResErrorCode.Fields("f003") 10 Then

MsgBox "產(chǎn)生一個嚴(yán)重錯誤,可能影響到系統(tǒng)的可操作性,請立即聯(lián)系本系統(tǒng)開發(fā)人員!", vbCritical, "嚴(yán)重錯誤"

End If

End If

'寫錯誤入文件----------------------------

intLogFile = FreeFile

Open App.Path "\" strIni.LogFile For Append As #intLogFile

Print #intLogFile, "***錯誤"; VBA.Now "*** " "Version:" _

str$(App.Major) "." str$(App.Minor) "." Format(App.Revision, "0000")

Print #intLogFile, "Error: " lngErrorNumber

Print #intLogFile, "Description: " strErrorDescription

Print #intLogFile, "Module: " strModule

Print #intLogFile, "Procedure: " strProcedure

Print #intLogFile, ""

Close #intLogFile

If Len(strMessage) 2 Then strErrorDescription = strMessage

strMessage = "錯誤: " "(" lngErrorNumber ")" strErrorDescription vbCrLf vbCrLf _

"模塊:" strModule "; 過程:" strProcedure

sVer = Trim(str$(App.Major) "." str$(App.Minor) "." _

Format(App.Revision, "0000"))

strCaption = "錯誤 Version: " sVer

'寫錯誤入數(shù)據(jù)庫表--------------------------

strSQL = "insert into error(f001,f002,f003,f004,f005,f006,f007,f008) values(" _

DateFmtB VBA.Now DateFmtE "," _

IIf(Len(Trim(strModule)) = 0, "null", "'" strModule "'") "," _

IIf(Len(Trim(strProcedure)) = 0, "null", "'" strProcedure "'") "," _

IIf(Len(Trim(lngErrorNumber)) = 0, "null", "'" lngErrorNumber "'") "," _

IIf(Len(Trim(strErrorDescription)) = 0, "null", "'" Replace(strErrorDescription, "'", "") "'") "," _

IIf(Len(Trim(sVer)) = 0, "null", "'" sVer "'") "," _

IIf(Len(Trim(sUserName)) = 0, "null", "'" sUserName "'") "," _

IIf(Len(Trim(sVer)) = 0, "null", "'" EthernetNO "'") ")"

Cn.Execute strSQL

'是否顯示未知錯誤信息

If Trim(UCase(showMsg)) = "Y" Then MsgBox strMessage, vbCritical, strCaption

PROC_EXIT:

Set Res = Nothing

Set ResErrorCode = Nothing

Exit Sub

ErrorHandle:

Resume Next

vb.net編譯時生成log文件夾

在程序目錄下生成log目錄,用于保存日志文件。

自動在log目錄中,生成日志文件,文件命名用年月日定義,如20100119_log.log。

在日志文件中,每行記錄一個時間點的運行內(nèi)容,時間點的精度應(yīng)該達(dá)到毫秒。


網(wǎng)頁標(biāo)題:vb.net寫入日志 vbnet recordset
當(dāng)前地址:http://fisionsoft.com.cn/article/dopjodh.html