I have little experience in general I am trying to implement the addition of registries in a window and it seems that the following code could be resembled that but not yet I can compile the code that I make bad?
class CDataInput : public CDialog {
public:
CInput *nombre;
CInput *depto;
CInput *cargo;
CDateInput *fn;
CDataInput(CDatabase *db) : CDialog(400,300,"Registro de Personas") {
database(db);
table("tbl_Personas");
keyField("IdPersona");
nombre = new CInput("Nombre Completo:");
//nombre->fieldName("NombreCompleto");
depto = new CInput("Depto:");
//depto->fieldName("Depto");
cargo = new CInput("Cargo:");
//cargo->fieldName("Cargo");
fn = new CDateInput("Fecha de Nac.:");
//fn->fieldName("FechaNacimiento");
end();
}
static void save()
{
CQuery IDQuery(&db,"SELECT max(person_id) FROM tbl_Personas");
CQuery InsertQuery(&db,"INSERT INTO tbl_Personas VALUES ( :person_id,
:person_name, :person_date, :person_depto, :person_cargo )");
try {
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.");
}
}
};
CDataInput *dataInput;
List hosted by Total Knowledge