QSqlDatabase db = QSqlDatabase::addDatabase( "QODBC3" );db.setDatabaseName( "Driver={SQL Native Client};Server=my_comp_name;Database=db_name;Trusted_Connection=yes;" );
TraceFile=/tmp/odbctrace.logTrace=Yes
for(int i = 0; i < (file.size() / 128); i++) { in.readRawData(kod, 17); in.readRawData(kod2, 17); in.readRawData(data, 11); in.readRawData(mars, 53); in.readRawData(data2, 30); query.prepare("INSERT INTO MR_FILE (kod, kod2, data, mars, data2)" "VALUES(:kod, :kod2, :data, :mars, :data2);"); query.bindValue(":kod", QString(kod).left(17)); query.bindValue(":kod2", QString(kod2).left(17)); query.bindValue(":data", QString(data).left(11)); query.bindValue(":mars", QString(mars).left(53)); query.bindValue(":data2", QString(data2).left(30)); query.exec();...
C++ (Qt)QSqlDatabase::database ().transaction ();query.prepare("INSERT INTO MR_FILE (kod, kod2, data, mars, data2)" "VALUES(:kod, :kod2, :data, :mars, :data2);");for(int i = 0; i < (file.size() / 128); i++) { in.readRawData(kod, 17); in.readRawData(kod2, 17); in.readRawData(data, 11); in.readRawData(mars, 53); in.readRawData(data2, 30); query.bindValue(":kod", QString(kod).left(17)); query.bindValue(":kod2", QString(kod2).left(17)); query.bindValue(":data", QString(data).left(11)); query.bindValue(":mars", QString(mars).left(53)); query.bindValue(":data2", QString(data2).left(30)); query.exec(); }QSqlDatabase::database ().commit ();