#include "ekrankartigorsel.h"
#include "ui_ekrankartigorsel.h"
#include "mainwindow.h"
#include "ekrankarti.h"
#include "ekrankartigorsel.h"
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QMainWindow>
#include <stdlib.h>
ekrankartigorsel::ekrankartigorsel(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ekrankartigorsel)
{
ui->setupUi(this);
}
ekrankartigorsel::~ekrankartigorsel()
{
delete ui;
}
void ekrankartigorsel::on_pushButton_2_clicked()
{
close();
}
void ekrankartigorsel::on_pushButton_clicked()
{
QString nedir = ui->cmbturu->currentText();
EkranKarti * yeni = new EkranKarti();
yeni->bellekTuru= ui->cmbturu->currentText();
yeni->bellekMiktari= ui->cmbmiktari->currentText();
yeni->bitMiktari= ui->cmbbitmiktari->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 tblEkranKarti (bellekTuru,bellekMiktari,bitMiktari,marka,model, alisfiyati, satisfiyati) ";
sorgu += " VALUES ( '"+yeni->bellekTuru+"' , '"+yeni->bellekMiktari+"', '"+yeni->bitMiktari+"', '"+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.