Literal syntax for strings In C and C++:

"This is a string"
This is a character --> 'c'
This is NOT valid -->  'character'

In Sqlite:

This is a column name "COL"
This is a literal string  'COL'

To write SQL with double quotes escaped in C/C++ use the backslash:

  char* sql = " SELECT \"column name\" FROM Table WHERE id = 'frogfur' ";

  Google is your friend. The answer to every one of your questions
is probably there waiting for you.


On 4/26/05, Corwin Burgess <[EMAIL PROTECTED]> wrote:
> I need to know what the solution is to translate the following Delphi
> lines so that they will compile with C++ and be valid SQL statements.
> 
> Delphi
> 
> sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Some
> Name",4,587.6594,"Here are some notes");';
> 
> sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES
> ("Another Name",12,4758.3265,"More notes");';
> 
> The following  won' t compile. What do you do about the double-quotes as
> in "Some Name", "Here are some notes",  "Another Name", and "More
> notes"? I can get it to compile if I use \" but that causes a SQL exception.
> 
> BCB6
> 
> sSQL = "INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Some
> Name",4,587.6594,"Here are some notes");";
> 
> sSQL = "INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES
> ("Another Name",12,4758.3265,"More notes");";
> 
> 
> Corwin
> 
> 


-- 
---
You a Gamer? If you're near Kansas City:
Conquest 36
https://events.reddawn.net

The Castles of Dereth Calendar: a tour of the art and architecture of
Asheron's Call
http://www.lulu.com/content/77264

Reply via email to