QSqlError Class

The QSqlError class provides SQL database error information. More...

Header: #include <QSqlError>
qmake: QT += sql

Public Types

enum ErrorType { NoError, ConnectionError, StatementError, TransactionError, UnknownError }

Detailed Description

A QSqlError object can provide database-specific error data, including the driverText() and databaseText() messages (or both concatenated together as text()), and the nativeErrorCode() and type().

See also QSqlDatabase::lastError() and QSqlQuery::lastError().

Member Type Documentation

enum QSqlError::ErrorType

This enum type describes the context in which the error occurred, e.g., a connection error, a statement error, etc.

ConstantValueDescription
QSqlError::NoError0No error occurred.
QSqlError::ConnectionError1Connection error.
QSqlError::StatementError2SQL statement syntax error.
QSqlError::TransactionError3Transaction failed error.
QSqlError::UnknownError4Unknown error.