Solved

inserting into a database using ExecuteSQL

Posted on 2001-06-06
5
183 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 50 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Handle Exceptions during instantiation 28 415
PDF library for Delphi 2 121
best sources to up-to-date in C++? 8 80
c++, dynamic object by json 1 42
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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