Solved

inserting into a database using ExecuteSQL

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now