C++ (Qt)#include "auct.h" int main(int argc, char *argv[]){    QApplication a(argc, argv);   QTextCodec *codec=QTextCodec::codecForName("CP1251");    QTextCodec::setCodecForCStrings(codec);    Auct *w= new Auct(0);    w->show();    return a.exec();}
C++ (Qt)#include "auct.h" Auct::Auct(QWidget *parent)    : QMainWindow(parent){ connection(); ui.setupUi(this); auct=new QSqlQueryModel(0); str="SELECT auction.id,Method_razm.Name,auction.Num_izv,Format(auction.Date_auct,'dd.mm.yyyy') "        "FROM auction INNER JOIN Method_razm ON auction.rf_methodID=Method_razm.id"; auct->setQuery(str,db); ui.tableView->setModel(auct); ui.tableView->hideColumn(0); connect(ui.tableView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(lpu())); this->setAttribute(Qt::WA_DeleteOnClose);}Auct::~Auct(){  if(db.isOpen()) db.close();}void Auct::connection(){ db = QSqlDatabase::addDatabase("QODBC"); db.setDatabaseName("ls"); if(!db.open()){ QMessageBox::critical(0,"Ошибка подключения",db.lastError().text()); }}void Auct::lpu(){int auctid;  sel=ui.tableView->selectionModel();  index=sel->currentIndex();    auctid=auct->data(auct->index(index.row(),0)).toInt(); zak= new Zakazchik(this,auctid); zak->show();}
C++ (Qt)#ifndef AUCT_H#define AUCT_H #include <QtGui/QMainWindow>..... #include "ui_Auct.h"#include "zakazchik.h" class Zakazchik;class Auct : public QMainWindow{    Q_OBJECT public:    Auct(QWidget *parent = 0);    ~Auct();    void connection();     QSqlDatabase db;    QSqlQueryModel *auct;    QString str;    QModelIndex index;    QItemSelectionModel *sel;    Zakazchik *zak;private:    Ui::AuctClass ui;private slots:    void lpu();};#endif // AUCT_H
C++ (Qt)Zakazchik::Zakazchik(QWidget *parent,int auctID)    : QMainWindow(parent){ ui.setupUi(this); auct.setNum(auctID); db=QSqlDatabase::database(); zakazch=new QSqlQueryModel(0); str="SELECT zakazchik.id,LPU.Name_LPU,LPU.INN,LPU.KPP,LPU.OGRN from "    "zakazchik INNER JOIN LPU ON zakazchik.rf_LPUID=LPU.Cod "    "where zakazchik.rf_auctID="+auct+""; zakazch->setQuery(str); ui.tableLPU->setModel(zakazch); connect(ui.add_lpu,SIGNAL(clicked()),this,SLOT(add_lpu())); connect(ui.tableLPU,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(zakaz())); connect(ui.otm,SIGNAL(clicked()),this,SLOT(close())); title=st;}Zakazchik::~Zakazchik(){ }
C++ (Qt)void Zakazchik::zakaz(){ int zakazchid; sel=ui.tableLPU->selectionModel(); index=sel->currentIndex(); zakazchid=zakazch->data(zakazch->index(index.row(),0)).toInt(); z=new Zakaz(this,zakazchid); z->show();}