0

What I'm trying to do is find all .db (Paradox) files from a directory and save them to .mdb. The thing is, to try if this works properly I've tried first opening an ACCDB (.db and .mdb I'll be using are resources only available in my school's internal network).

I've already checked, and I've found the sql drivers in the Qt directory, I've also added QT +=sql in my pro file, I've installed the access database engine, VBA is also installed, but I can't manage to open the connection. I'm yet to try connecting to a SQLITE database to try if it works, but I'm guessing it will. Here is the code, triggered from a button:

db.addDatabase("QODBC");
explorador.setFileMode(QFileDialog::Directory);
ruta=explorador.getExistingDirectory(this,"Seleccionar directorio");
directorio.setPath(ruta);
subdir=directorio.entryList(QDir::AllDirs);
//La lista comienza en el 2ยบ elemento
for(int i=2;i<subdir.size();i++)
{
    subruta=ruta+"/"+subdir.at(i);
    directorio.setPath(subruta);
    db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+subruta+"/Base de datos11.accdb");
    bool check=db.open();
    if(check)
        {
            dbg.setText("Prueba");
            dbg.show();
        }
    else
    {
        dbg.setText("Pruebaaa");
        dbg.show();
    }

}

Have any ideas?? Thank you!

Jared Burrows
  • 54,294
  • 25
  • 151
  • 185

1 Answers1

0

I eventually solved it kind of bypassing through access. If someone else is struggling with this you need:

-Paradox DB engine (Be sure the version you download matches your .db file)

-Jet engine 4.0 or later

-access 2007 (Following version have removed Paradox DB connection)

-Administrator privileges to access the database engine folders(both jet and paradox)

Simply open the database through a connection or database object. Sintax should be something like this (Via a VBA module in access):

database.open(path,*Dont rememer what goes in here,*here goes the read/write permits,"Paradox 5.x")

Path should be pointing to a folder containing one or more .db files, which will be opened as a a single database with the files being tables. It actually genereates a new database (Either .accdb or .mdb, depending how you save it)

It is not exactly like this, but I'm on my laptop. I'll edit the answer once I'm in front of my code

Sorry it is not a c++ answer, but from what I've found it is kind of a pain in the a** to work with paradox databases. Hope this helps others with the struggle.

Ricardo