SQLITE CREATE DATABASE DBEXPRESS
Posted: Wed 10 Sep 2014 08:35
Hello
I am using SQLITE with DBExpress under C++ builder XE4 and I cannot get the connection to create a database file if the file exists.
I get a file is missing exception when I try to open the database.
If I connect to an already existing database then that works fine.
I would like the open to create an empty database file if there isn't one already
There are examples on her for the LiteDAC which specify setting the Options, these don't exist for the DBExpress connection.
I am using SQLITE with DBExpress under C++ builder XE4 and I cannot get the connection to create a database file if the file exists.
Code: Select all
TSQLConnection * SQLConnection;
// Devart SQL Lite Direct connection
SQLConnection->ConnectionName = "Devart SQLite Direct";
SQLConnection->DriverName = "DevartSQLiteDirect";
SQLConnection->GetDriverFunc = "getSQLDriverSQLiteDirect";
SQLConnection->LibraryName = "dbexpsqlite40.dll";
SQLConnection->LoginPrompt = false;
SQLConnection->Params->BeginUpdate();
SQLConnection->Params->Clear();
SQLConnection->Params->Add("DataBase=" + DatabaseFilename);
SQLConnection->Params->Add("FailIfMissing=False");
SQLConnection->Params->EndUpdate();
SQLConnection->ParamsLoaded = true;
SQLConnection->Connected = true;
If I connect to an already existing database then that works fine.
I would like the open to create an empty database file if there isn't one already
There are examples on her for the LiteDAC which specify setting the Options, these don't exist for the DBExpress connection.