Solved

inserting into a database using ExecuteSQL

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Find Visual Studio Tools 2 92
Setting nameservers after res_init fails doing res_query 2 85
How to gracefully close the c++ 11 thread? 3 83
Safe conversion? 4 57
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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

911 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

24 Experts available now in Live!

Get 1:1 Help Now