Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

inserting into a database using ExecuteSQL

Posted on 2001-06-06
5
Medium Priority
?
190 Views
Last Modified: 2010-04-02
I am trying to insert a variable into a database is this possible if so how.

this is what im trying to do

i->Word which is a string variable.
while j< 10;
db.ExecuteSQL(i->word);
0
Comment
Question by:holiday1
  • 3
5 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6161145
What OS?
What type of project?
What compiler?
What type of database?

Give more details please.
0
 
LVL 32

Expert Comment

by:jhance
ID: 6161146
ExecuteSQL expects a LPCSTR (const char *) and not a string.  Use the c_str member of the string template to get a "C" string that will be acceptable to ExecuteSQL.

Something like:

db.ExecuteSQL((i->word).c_str);

0
 
LVL 32

Expert Comment

by:jhance
ID: 6161151
Oops... Is should have posted that as an answer....

I'm sure nietoad will hop on this shortly!  ;-)
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 6161154
And I meant to write:

db.ExecuteSQL((i->word).c_str());
0
 

Author Comment

by:holiday1
ID: 6161221
Thanks its not a school project so no harm done.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question