Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
Subject: mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Subject: Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
Subject: MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Subject: Re: Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Subject: Using a template query does not work

Subject: Using a template query does not work

2007-09-27       - By Maarten Schrijvers

 Back
I have written the following code, using a template query. But it goes wrong
somehow. I am using VS2005

static std::string vNaam;
// etc...

mysqlpp::Query qInsRel = con.query();
qInsRel << "INSERT INTO tblrelatie (Naam, Voornamen, Roepnaam, Geslacht,
SoFiNummer, ddGeboorte,"
" Geboorteplaats, Nationaliteit, TitelID, RelatiesoortID, Voorvoegsel,
PartnerID) VALUES "
"(%0q, %1q, %2q, %3q, %4q, %5q, %6q, %7q, %8q, %9q, %10q, %11q)";
qInsRel.parse();

MessageBox::Show(ToUCS2(vNaam.c_str()),"En nu?"); //want to see if my
variable still has the correct value (it does)

mysqlpp::ResNSel InsRelRes = qInsRel.execute(vNaam, vVoornamen, vRoepnaam,
vGeslacht, vSofi, vddGeboorte, vGebpl, vNationaliteit,
vTitelID, vRelatiesrtID, vVoorvoegsel, vPartnerID);

String^ prev = ToUCS2(qInsRel.preview().c_str()); //using this in a
messagebox to see what the query looks like...This is my last breakpoint
before things go wrong

It compiles just fine. But then at run time it does this:
"An unhandled exception of type 'System.Runtime.InteropServices.SEHException'
occurred in mysqlpp.dll
Additional information: Een extern onderdeel heeft een uitzondering
veroorzaakt."
VS then points at query.cpp line 385 "SQLString& param = (*c)[num];"
c and param are <undefined value> num is 0 (which I assume it should be)
What am I doing wrong?
Thanks, Maarten