Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QSqlSelectCursor Class Reference

The QSqlSelectCursor class provides browsing of general SQL SELECT statements. More...

    #include <QSqlSelectCursor>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits QSqlCursor.

- List of all members, including inherited members

### Public Functions

- QSqlSelectCursor ( const QString & query = QString(), QSqlDatabase db = QSqlDatabase() )
- QSqlSelectCursor ( const QSqlSelectCursor & other )
- ~QSqlSelectCursor ()

- 42 public functions inherited from QSqlCursor
- 25 public functions inherited from QSqlRecord
- 32 public functions inherited from QSqlQuery

### Protected Functions

- 6 protected functions inherited from QSqlCursor
- 2 protected functions inherited from QSqlQuery

## Detailed Description

The QSqlSelectCursor class provides browsing of general SQL SELECT statements.

QSqlSelectCursor is a convenience class that makes it possible to display result sets from general SQL `SELECT` statements in data-aware Qt widgets. QSqlSelectCursor is read-only and does not support `INSERT`, `UPDATE` or `DELETE` operations.

Pass the query in at construction time, or use the QSqlSelectCursor::exec() function.

Example:

        ...
        QSqlSelectCursor* cur = new QSqlSelectCursor("SELECT id, firstname, lastname FROM author");
        QDataTable* table = new QDataTable(this);
        table->setSqlCursor(cur, true, true);
        table->refresh();
        ...
        cur->exec("SELECT * FROM books");
        table->refresh();
        ...

## Member Function Documentation

### QSqlSelectCursor::QSqlSelectCursor ( const QString & query = QString(), QSqlDatabase db = QSqlDatabase() )

Constructs a read only cursor on database db using the query query.

### QSqlSelectCursor::QSqlSelectCursor ( const QSqlSelectCursor & other )

Constructs a copy of other

### QSqlSelectCursor::~QSqlSelectCursor ()

Destroys the object and frees any allocated resources