On Sun, Apr 10, 2005 at 07:47:52PM -0700, timothy johnson wrote:
> What about using vars in the query line?
>
> query << "SELECT * FROM table WHERE id=" . var;
> this way didnt work
>
> sprintf(query. "SELECT * FROM table WHERE id=%i". var);
> nor did this way work.
This is C++, not PHP or perl.
query << "SELECT * FROM table WHERE id=" << var;
If you're building SQL from scratch, make sure you quote properly as well.
Going from memory, I think you use the quote manipulator like this,
but I could be wrong, I don't use it regularly:
query << "SELECT * FROM table WHERE id=" << quote << var;
- Chris