it works very wellThe CDialog class shows the buttons OK and Cancel, now like showing single the Ok button. it is possible?
From: "Alexey Parshin" <alexeyp@gmail.com> To: "HERNAN LAGRAVA" <hernanjls@hotmail.com> Subject: Re: insert record (return value method save)? Date: Wed, 7 Jun 2006 15:21:34 +1000 If after save() you want to close the dialog window - then return true. If you have an error during save(), then most likely you want to show this error with spError() function, and return false - to allow the user to decide what to do. 2006/6/7, HERNAN LAGRAVA <hernanjls@hotmail.com>:now the compile process said this message error C4716: 'CDataInput::save' : must return a value as value it must return the method? well, then code is the follow virtual bool save() { CQuery IDQuery(database(),"SELECT max(IdPersona) FROM tbl_Personas"); CQuery InsertQuery(database(),"INSERT INTO tbl_Personas VALUES ( :person_id, :person_name, :person_date, :person_depto, :person_cargo )"); try { IDQuery.open(); InsertQuery.param("person_id") = IDQuery[0].asInteger() + 1; InsertQuery.param("person_name") = nombre->data(); InsertQuery.param("person_date") = fn->data(); InsertQuery.param("person_depto") = depto->data(); InsertQuery.param("person_cargo") = cargo->data(); InsertQuery.exec(); } catch (CException& e) { printf("\nError: %s\n",e.text().c_str()); puts("\nSorry, NO SE GUARDO EL REGISTRO."); } }-- Alexey Parshin, http://www.sptk.net
List hosted by Total Knowledge