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
|
|