📄 utility.vb
字号:
Imports System.Data.SqlServerCe
Imports System.Data.SqlServerCe.SqlCeException
Imports System.text
Public Class Utility
Public Function ComposeSqlErrorMessage(ByVal e As SqlCeException) As String
Dim errorCollection As SqlCeErrorCollection = e.Errors
Dim bld As New StringBuilder
Dim inner As Exception = e.InnerException
' Compose SQL Server CE error information into a single string
If Not (inner Is Nothing) Then
bld.Append(("Inner Exception: " & inner.ToString()))
End If
Dim err As SqlCeError
For Each err In errorCollection
bld.Append(ControlChars.Cr & "Error:" & err.HResult.ToString("X"))
bld.Append(ControlChars.Cr & err.Message)
bld.Append(ControlChars.Cr & "Native Error:" & err.NativeError)
bld.Append(ControlChars.Cr & err.Source)
Dim numPar As Integer
For Each numPar In err.NumericErrorParameters
If numPar <> 0 Then
bld.Append(ControlChars.Cr & "N-Parm:" & numPar.ToString())
End If
Next numPar
Dim errPar As String
For Each errPar In err.ErrorParameters
If errPar <> [String].Empty Then
bld.Append(ControlChars.Cr & "E-Parm:" & errPar)
End If
Next errPar
Next err
Return bld.ToString()
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -