sptk



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

insert record (return value method save)?




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.");
			}

	 }



List hosted by Total Knowledge

Authoright © Total Knowledge: 2005