Vijay Kumbhani
Vijay Kumbhani

Reputation: 742

How to create a database programmatically in Sqlite using C++?

I am using Visual Studio. Using VC++/MFC and SQLite, how would I programmatically create a database?

Upvotes: 0

Views: 1236

Answers (2)

AmitB
AmitB

Reputation: 752

You don't have to use a wrapper for doing that. You can simply use the sqlite3_open_v2 function with the SQLITE_OPEN_CREATE flag:

sqlite3* pDb = NULL;
int rc = sqlite3_open_v2("yourDbName.db", &pDb, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
assert(rc == SQLITE_OK);

Upvotes: 1

James King
James King

Reputation: 1614

You need a Sqlite wrapper for C++.

You can find some here: http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers

One example is here: http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite

Upvotes: 0

Related Questions