bozuk ram

#include "ramgorsel.h" #include "ui_ramgorsel.h" #include "ram.h" #include "mainwindow.h" #include <QSqlDatabase> #include <QSqlQuery> #include <QMainWindow> #include <stdlib.h> ramgorsel::ramgorsel(QWidget *parent) : QMainWindow(parent), ui(new Ui::ramgorsel) { ui->setupUi(this); } ramgorsel::~ramgorsel() { delete ui; } void ramgorsel::on_pushButton_2_clicked() { close(); } void ramgorsel::on_pushButton_clicked() { Ram * yeni = new Ram(); yeni->turu= ui->cmbturu->currentText(); yeni->marka=ui->cmbmarkasi->currentText(); yeni->model = ui->cmbmodeli->currentText(); yeni->alisFiyati = ui->txtalis->text().toDouble(); yeni->satisFiyati= ui->txtsatis->text().toDouble(); QString sorgu = "INSERT INTO tblRam (turu,marka,model, alisfiyati, satisfiyati) "; sorgu += " VALUES ( '"+yeni->turu+"', '"+yeni->marka+"', '"+yeni->model+"', "+ui->txtalis->text()+","+ui->txtsatis->text()+" ) "; QSqlDatabase db;// = QSqlDatabase::addDatabase("QSQLITE", "D:\\erkanVt.db"); db =QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("D:\\erkanVt.db"); db.open(); QSqlQuery query; query.prepare(sorgu); query.exec(); ui->txtalis->setText(sorgu); return ; ui->txtsatis->setText(sorgu); try{ } catch (std::exception & e) { ui->txtalis->setText(e.what()); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.