Tom,
I appreciate you're help but I'm pretty sure that the semicolon has
to be there (well. at least it's required in all the other statements
I've written to date -- this one statement is part of a much large
program that's working fine other than for this one ATTACH).
My guess is that SQLite3 doesn't know where to find my database, but
I'm not sure how to tell it where to look.
-Greg
On Aug 19, 2005, at 6:07 AM, Thomas Briggs wrote:
I think that the semi-colon at the end of the statement is what's
causing your problem. The command shell requires the semi-colon to
mark
the end of a statement; in code, your statement ends at the end of the
string.
-Tom
-----Original Message-----
From: Greg Stark [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 18, 2005 7:38 PM
To: [email protected]
Subject: [sqlite] How do I attach a database from C++?
I'm having difficulty attaching a database from C++.
Within my code, I'm using an sqlite3_prepare call:
prepareResult = pSqlBundle->sqlite3_prepare (db_, "ATTACH
DATABASE 'window_5.sdb' AS W5;", -1, &attachSqlStmt, &tailOfSqlStmt);
but it returns an error (i.e., prepareResult comes back as
SQLITE_ERROR).
Just to make sure that there were no problems with the databases or
my syntax, I tried the attach command (i.e., ATTACH DATABASE
'window_5.sdb' AS W5;) from the command line, and everything worked
fine. I tried using the full path name for the database-filename,
but that didn't work either.
I'm sure it's something simple, but what I'm I doing wrong?
Thanks,
Greg