summaryrefslogtreecommitdiffstats
path: root/src/sql/doc/snippets/code/src_sql_kernel_qsqlerror.cpp
blob: 85a0ca6665e5a03afe6ccd4e2744cc4a1e794602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlQueryModel>
#include <QSqlError>
#include <QDebug>

void checkSqlQueryModel()
{
//! [0]
QSqlQueryModel model;
model.setQuery("select * from myTable");
if (model.lastError().isValid())
    qDebug() << model.lastError();
//! [0]
}