Propriedade Errors
Obtém uma coleção de um ou mais objetos SqlCeError que contêm informações detalhadas sobre as exceções geradas pelo Provedor de Dados do .NET Compact Framework para SQL Server Compact 3.5.
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (em System.Data.SqlServerCe.dll)
Sintaxe
'Declaração
Public ReadOnly Property Errors As SqlCeErrorCollection
Get
'Uso
Dim instance As SqlCeException
Dim value As SqlCeErrorCollection
value = instance.Errors
public SqlCeErrorCollection Errors { get; }
public:
property SqlCeErrorCollection^ Errors {
SqlCeErrorCollection^ get ();
}
member Errors : SqlCeErrorCollection
function get Errors () : SqlCeErrorCollection
Valor da propriedade
Tipo: System.Data.SqlServerCe. . :: . .SqlCeErrorCollection
O objeto SqlCeErrorCollection que contém as instâncias coletadas da classe SqlCeError para a exceção.
Comentários
A classe SqlCeErrorCollection sempre contém pelo menos uma instância da classe SqlCeError.
Exemplos
O exemplo a seguir exibe cada SqlCeError da coleção SqlCeErrorCollection.
Try
Dim repl As New SqlCeReplication()
' Fill repl properites here
' ...
' SqlCeReplication may throw SqlCeException which contains a
' collection of errors; SQL Mobile database engine always
' returns one error in the collection
'
repl.Synchronize()
Catch e As SqlCeException
Dim err As SqlCeError
For Each err In e.Errors
' Use SqlCeError properties if you need specific
' application logic depending on the error condition
'
If 28577 = [err].NativeError Then 'SSCE_M_SCHEMAHASCHANGED
' Error specific logic goes here...
'
End If
' Note: For native error numbers, refer to SQL Server Mobile Errors
' in the SQL Server Mobile Books Online
'
MessageBox.Show([err].Message)
Next err
End Try
try
{
SqlCeReplication repl = new SqlCeReplication();
// Fill repl properites here
// ...
// SqlCeReplication may throw SqlCeException which contains a
// collection of errors; SQL Mobile database engine always
// returns one error in the collection
//
repl.Synchronize();
}
catch (SqlCeException e)
{
foreach (SqlCeError error in e.Errors)
{
// Use SqlCeError properties if you need specific
// application logic depending on the error condition
//
if (28577 == error.NativeError /*SSCE_M_SCHEMAHASCHANGED*/)
{
// Error specific logic goes here...
//
}
// Note: For native error numbers, refer to SQL Server Mobile Errors
// in the SQL Server Mobile Books Online
//
MessageBox.Show(error.Message);
}
}