SqlCeErrorCollection Class
Recueille toutes les erreurs générées par le fournisseur de données .NET Compact Framework pour SQL Server Compact 3.5. Cette classe ne peut pas être héritée.
Espace de noms: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (dans system.data.sqlserverce.dll)
Syntaxe
'Déclaration
<DefaultMemberAttribute("Item")> _
Public NotInheritable Class SqlCeErrorCollection
Implements ICollection, IEnumerable
[DefaultMemberAttribute("Item")]
public sealed class SqlCeErrorCollection : ICollection, IEnumerable
[DefaultMemberAttribute(L"Item")]
public ref class SqlCeErrorCollection sealed : ICollection, IEnumerable
/** @attribute DefaultMemberAttribute("Item") */
public final class SqlCeErrorCollection implements ICollection, IEnumerable
DefaultMemberAttribute("Item")
public final class SqlCeErrorCollection implements ICollection, IEnumerable
Remarques
Cette classe est créée par SqlCeException pour collecter les instances de la classe SqlCeError. SqlCeErrorCollection comporte toujours au moins une instance de la classe SqlCeError.
Hiérarchie d'héritage
System.Object
System.Data.SqlServerCe.SqlCeErrorCollection
Exemple
L'exemple suivant affiche chaque SqlCeError dans la collection SqlCeErrorCollection.
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);
}
}
Sécurité des threads
Tout membre statique public (Partagé dans Microsoft Visual Basic) de ce type sont thread-safe. Tous les membres de l'instance ne sont pas garantis comme sûrs.
Plateformes
Plateformes de développement
Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
Informations sur la version
.NET Framework et NET Compact Framework
Pris en charge dans 3.5
.NET Framework
Pris en charge dans 3.0
.NET Compact Framework et .Net Framework
Pris en charge dans 2.0
Voir aussi
Référence
SqlCeErrorCollection Members
System.Data.SqlServerCe Namespace
SqlCeError Class
SqlCeException