SqlCeErrorCollection.Count 属性
获取集合中的 SqlCeError 对象数。
命名空间: System.Data.SqlServerCe
程序集: System.Data.SqlServerCe(在 system.data.sqlserverce.dll 中)
语法
声明
Public ReadOnly Property Count As Integer
用法
Dim instance As SqlCeErrorCollection
Dim value As Integer
value = instance.Count
public int Count { get; }
public:
virtual property int Count {
int get () sealed;
}
/** @property */
public final int get_Count ()
public final function get Count () : int
不适用。
属性值
集合中的 SqlCeError 对象的总数。
示例
下面的示例显示 SqlCeErrorCollection 中的每个 SqlCeError。
Public Sub DisplaySqlCeErrors(ByVal errorCollection As SqlCeErrorCollection)
Dim err As SqlCeError
Dim bld As New StringBuilder()
For Each err In errorCollection
bld.Append((ControlChars.Cr & " Error Code: " & err.HResult.ToString("X")))
bld.Append((ControlChars.Cr & " Message : " & err.Message))
bld.Append((ControlChars.Cr & " Minor Err.: " & err.NativeError))
bld.Append((ControlChars.Cr & " Source : " & err.Source))
Dim numPar As Integer
For Each numPar In err.NumericErrorParameters
If 0 <> numPar Then
bld.Append((ControlChars.Cr & " Num. Par. : " & numPar))
End If
Next numPar
Dim errPar As String
For Each errPar In err.ErrorParameters
If [String].Empty <> errPar Then
bld.Append((ControlChars.Cr & " Err. Par. : " & errPar))
End If
Next errPar
MessageBox.Show(bld.ToString())
bld.Remove(0, bld.Length)
Next err
End Sub 'DisplaySqlCeErrors
public void DisplaySqlCeErrors(SqlCeErrorCollection errorCollection ) {
StringBuilder bld = new StringBuilder();
foreach (SqlCeError err in errorCollection) {
bld.Append("\n Error Code: " + err.HResult.ToString("X"));
bld.Append("\n Message : " + err.Message);
bld.Append("\n Minor Err.: " + err.NativeError);
bld.Append("\n Source : " + err.Source);
foreach (int numPar in err.NumericErrorParameters) {
if (0 != numPar) bld.Append("\n Num. Par. : " + numPar);
}
foreach (string errPar in err.ErrorParameters) {
if (String.Empty != errPar) bld.Append("\n Err. Par. : " + errPar);
}
MessageBox.Show(bld.ToString());
bld.Remove(0, bld.Length);
}
}
平台
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。
版本信息
.NET Framework
受以下版本支持:3.0
.NET Compact Framework
受以下版本支持:2.0、1.0
请参见
参考
SqlCeErrorCollection 类
SqlCeErrorCollection 成员
System.Data.SqlServerCe 命名空间