Answer the question
In order to leave comments, you need to log in
Why is text not outputting from Sqlite database in QT creator?
<b>Сам Код </b><i></i>
#include "dreaminfo.h"
#include "ui_dreaminfo.h"
#include "info.h"
DreamInfo::DreamInfo(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::DreamInfo)
{
ui->setupUi(this);
}
DreamInfo::~DreamInfo()
{
delete ui;
}
void DreamInfo::on_pushButton_clicked()
{
Info drem;
drem.setModal(true);
drem.exec();
}
void DreamInfo::on_pushButton_7_clicked()
{
//Подключаем базу данных
QSqlDatabase db;
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("tehno.db");
db.open();
//Осуществляем запрос
QSqlQuery query;
query.exec("SELECT name FROM People");
//Выводим значения из запроса
while (query.next())
{
QString name = query.value(0).toString();
ui->textBrowser->insertPlainText( name+ "\n");
}
}
Answer the question
In order to leave comments, you need to log in
Because here is https://stackoverflow.com/questions/25483218/handl...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question