OleDbError Classe
Definição
Coleta informações relevantes para um aviso ou erro retornado pela fonte de dados.Collects information relevant to a warning or error returned by the data source.
public ref class OleDbError sealed
[System.Serializable]
public sealed class OleDbError
type OleDbError = class
Public NotInheritable Class OleDbError
- Herança
-
OleDbError
- Atributos
Exemplos
O exemplo a seguir exibe as propriedades do OleDbError.The following example displays the properties of the OleDbError.
public void DisplayOleDbErrorCollection(OleDbException exception)
{
for (int i = 0; i < exception.Errors.Count; i++)
{
Console.WriteLine("Index #" + i + "\n" +
"Message: " + exception.Errors[i].Message + "\n" +
"Native: " + exception.Errors[i].NativeError.ToString() + "\n" +
"Source: " + exception.Errors[i].Source + "\n" +
"SQL: " + exception.Errors[i].SQLState + "\n");
}
Console.ReadLine();
}
Public Sub DisplayOleDbErrorCollection(ByVal exception As OleDbException)
Dim i As Integer
For i = 0 To exception.Errors.Count - 1
Console.WriteLine("Index #" & i.ToString() & ControlChars.Cr _
& "Message: " & exception.Errors(i).Message & ControlChars.Cr _
& "Native: " & exception.Errors(i).NativeError.ToString() & ControlChars.Cr _
& "Source: " & exception.Errors(i).Source & ControlChars.Cr _
& "SQL: " & exception.Errors(i).SQLState & ControlChars.Cr)
Next i
Console.ReadLine()
End Sub
Comentários
Essa classe é criada pelo adaptador de dados OleDb quando ocorre um erro.This class is created by the OleDb data adapter when an error occurs. Uma instância do OleDbError é criada e gerenciada OleDbErrorCollection pela classe, que, por OleDbException sua vez, é criada pela classe.An instance of OleDbError is created and managed by the OleDbErrorCollection class, which in turn is created by the OleDbException class.
Se a severidade do erro for muito grande, o servidor poderá fechar o OleDbConnection.If the severity of the error is too great, the server may close the OleDbConnection. No entanto, o usuário pode reabrir a conexão e continuar.However, the user can reopen the connection and continue.
Propriedades
Message |
Obtém uma descrição breve do erro.Gets a short description of the error. |
NativeError |
Obtém as informações de erro específicas do banco de dados.Gets the database-specific error information. |
Source |
Obtém o nome do provedor que gerou o erro.Gets the name of the provider that generated the error. |
SQLState |
Obtém o código de erro de cinco caracteres seguindo o padrão ANSI SQL para o banco de dados.Gets the five-character error code following the ANSI SQL standard for the database. |
Métodos
Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
ToString() |
Obtém ou define o texto completo da mensagem de erro.Gets the complete text of the error message. |