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
> 

Reply via email to