Mike Gleason Jr Couturier writes: > Hello all ! > > I'm creating an MFC program with the mySQL API. > Everything is working fine but when exceptions > occurs (ie when connecting, changing databases...), > I can't display the er.error message to the user... > > How can I convert the error message to a char * or > a CString ?!?! > > [...] > catch (BadQuery er) { > AfxMessageBox((CString)er.error); // Error ! > } > > Error : > cannot convert from 'class std::basic_string<char,struct > std::char_traits<char>,class std::allocator<char> >' > to 'class CString' > > Thanks !! > Hi!
First of all, you are not using MySQL API but MySQL++ API. You should know STL better then MFC, as STL is standard and works (more or less) everywhere, while MFC works with VC++ / Windows only. You can always use c_str() method to get char * from basic_string .... -- Regards, __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php