Dear
I have following problem with mysql++ and visual studio2008 professional edition.
My program code is like this ...which is just replica of what the example provided by
mysql++.
#include <mysql++.h>
#include <iostream>
#include <iomanip>
using namespace std;
int
main(int argc, char *argv[])
{
// Get database access parameters from command line
const char* db ="innoviti",*server="localhost",*user="root",*pass="xxxxx";
// Connect to the sample database.
mysqlpp::Connection conn(false);
if (conn.connect(db, server, user, pass)) {
// Retrieve a subset of the sample stock table set up by resetdb
// and display it.
mysqlpp::Query query = conn.query("INSERT INTO biometric(employee_id)VALUES('65987')");
if (mysqlpp::StoreQueryResult res = query.store()) {
cout << "We have:" << endl;
for (size_t i = 0; i < res.num_rows(); ++i) {
cout << '\t' << res[i][0] << endl;
}
}
else {
cerr << "Failed to get item list: " << query.error() << endl;
return 1;
}
return 0;
}
else {
cerr << "DB connection failed: " << conn.error() << endl;
return 1;
}
}
when I executed this code.It is compiled and build succesfully.But at the end it gives an
error popup and message like this:
#.......................................................................................
Debug error!
Run Time Check Failure #2-Stack around the variable 'conn'was corrupted.
(Press retry to debug the application)
#................................................................................
Despite this message query get executed data is inserted into database.But how do I remove
this ,I don't know.(Possibly its region might be memory allocated to "conn" variable is
less what it expected).
I had executed the mysql++ source file as well its example succesfully.And i have also
link the header file of mysql++ and mysql server to the project and also provide the full
path of library of mysql and mysql++.I have also put the following line to command line
option of linker 'mysqlpp.lib,mysqlpp_d.lib,libmysql.lib,wsock32.lib.
My system configuration is like this:
Os :Windows XP sp2
visual studio 2008 professional
mysql++ 3.0.6
mysql server 5.0.45
:::: Please somebody help me out.