Solved

inserting into a database using ExecuteSQL

Posted on 2001-06-06
5
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

623 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