Ver Mensaje Individual
  #3  
Antiguo 03-12-2014
maxzama maxzama is offline
Miembro
NULL
 
Registrado: jun 2011
Posts: 126
Reputación: 13
maxzama Va por buen camino
Como pasar un base de dato a otra?

Gracias por su ayuda...

Utilizo IBexpert.

base de dato IBexpert: Madre, IngresoMadre.

Utilizo dos IBdataset, para la base de datos que son Madre1, IngresoMadre1. Que tienen los mismo campos.


Mensaje Error: Me dice Que fue exitoso. y al yo ver la base de dato(no hay nada, Guarda vació).
// el código tiene una condición, que al buscar en la base dato, se encuentra.Que lo modifique. Si no lo encuentra, que lo inserte.
//Necesito saber que me falta o que coloque mal...


tengo una palabra buscar2, dentro del código (botón guardar). que ase un llamado al siguiente código (buscar2):

function Buscar2(cd:String):boolean;
begin
Dmodulo.Madre1.close;
Dmodulo.Madre1.SelectSQL.Text:='select * from Madre where CEDULA=:OLD';
Dmodulo.Madre1.ParamByname('OLD').value:=Dmodulo.RegistroMadre1.FieldByName('CEDULA').AsString;
Dmodulo.Madre1.Open;
if NOT Dmodulo.Madre1.IsEmpty then
result:=true
else
result:=false;

buscar2:=result;

end;


Código dentro del Botón Guardar:

begin
if application.MessageBox('DESEA GUARDAR?','guardar un Registro',
MB_ICONQUESTION OR MB_YESNO) = ID_YES then
begin
{ if (edit1.Text='') then //or (edit2.Text='') or (EDIT9.Text='') or (EDIT10.Text='') or (EDIT11.Text='')
begin
showmessage('La Cedula no puede quedar en blanco')
end
else }
begin
if Buscar2(Edit1.Text) then
begin
Dmodulo.Madre1.Close;
Dmodulo.Madre1.SelectSQL.Text:=Dmodulo.Madre1.ModifySQL.Text;
Dmodulo.Madre1.ParamByName('OLD_CEDULA'). AsString:=Dmodulo.RegistroMadre1.FieldByName('CEDULA').AsString;
end
else
begin
Dmodulo.Madre1.Close;
Dmodulo.Madre1.SelectSQL.Text:=Dmodulo.Madre1.InsertSQL.Text;
Dmodulo.Madre1.ParamByName('CEDULA'). AsString:=Dmodulo.RegistroMadre1.FieldByName('CEDULA').AsString;
end;
Dmodulo.Madre1.ParamByName('PRIMERNOMBRE').AsString:=Dmodulo.RegistroMadre1.FieldByName('PRIMERNOMBR E').AsString;
Dmodulo.Madre1.ParamByName('PRIMERAPELLIDO').AsString:=Dmodulo.RegistroMadre1.FieldByName('PRIMERAPE LLIDO').AsString;
Dmodulo.Madre1.ParamByName('SEGUNDOAPELLIDO').AsString:=Dmodulo.RegistroMadre1.FieldByName('SEGUNDOA PELLIDO').AsString;

if (form6.RadioButton1.Checked=true) or (form6.RadioButton2.Checked=true) then
begin
Dmodulo.Madre1.ParamByName('SEXO').AsInteger:= Dmodulo.RegistroMadre1.FieldByName('SEXO').AsInteger; //'f'

end
else
if (form6.RadioButton1.Checked=true) or (form6.RadioButton2.Checked=true) then
begin
Dmodulo.Madre1.ParamByName('SEXO').AsInteger:=Dmodulo.RegistroMadre1.FieldByName('SEXO').AsInteger; //'M'

end;

//Dmodulo.Madre1.ParamByName('NACIMIENTO').AsDate:=Dmodulo.RegistroMadre1.ParamByName('NACIMIENTO').As Date;

Dmodulo.Madre1.ParamByName('ESTADOCIVIL').AsString:=Dmodulo.RegistroMadre1.FieldByName('ESTADOCIVIL' ).AsString;
Dmodulo.Madre1.ParamByName('CIUDADMADRE').AsString:=Dmodulo.RegistroMadre1.FieldByName('CIUDADMADRE' ).AsString;
Dmodulo.Madre1.ParamByName('MUNICIPIOMADRE').AsString:=Dmodulo.RegistroMadre1.FieldByName('MUNICIPIO MADRE').AsString;
Dmodulo.Madre1.ParamByName('PARROQUIAMADRE').AsString:=Dmodulo.RegistroMadre1.FieldByName('PARROQUIA MADRE').AsString;
Dmodulo.Madre1.ParamByName('TIPOVIA').AsString:=Dmodulo.RegistroMadre1.FieldByName('TIPOVIA').AsStri ng;
Dmodulo.Madre1.ParamByName('DESCRIPCIONVIA').AsString:=Dmodulo.RegistroMadre1.FieldByName('DESCRIPCI ONVIA').AsString;
Dmodulo.Madre1.ParamByName('TIPOVIVIENDA').AsString:=Dmodulo.RegistroMadre1.FieldByName('TIPOVIVIEND A').AsString;
Dmodulo.Madre1.ParamByName('PUNTOREFERENCIA').AsString:=Dmodulo.RegistroMadre1.FieldByName('PUNTOREF ERENCIA').AsString;
Dmodulo.Madre1.ParamByName('TIPONUCLEO').AsString:=Dmodulo.RegistroMadre1.FieldByName('TIPONUCLEO'). AsString;
Dmodulo.Madre1.ParamByName('DESCRIPCIONNUCLEO').AsString:=Dmodulo.RegistroMadre1.FieldByName('DESCRI PCIONNUCLEO').AsString;
Dmodulo.Madre1.ParamByName('CODIGOAREA').AsString:=Dmodulo.RegistroMadre1.FieldByName('CODIGOAREA'). AsString;
Dmodulo.Madre1.ParamByName('TLFFIJO').AsString:=Dmodulo.RegistroMadre1.FieldByName('TLFFIJO').AsStri ng;
Dmodulo.Madre1.ParamByName('TLFCELULAR').AsString:=Dmodulo.RegistroMadre1.FieldByName('TLFCELULAR'). AsString;
Dmodulo.Madre1.ParamByName('CORREOMADRE').AsString:=Dmodulo.RegistroMadre1.FieldByName('CORREOMADRE' ).AsString;
Dmodulo.Madre1.ParamByName('TIPOOCUPACION').AsString:=Dmodulo.RegistroMadre1.FieldByName('TIPOOCUPAC ION').AsString;
Dmodulo.Madre1.ParamByName('CARGO').AsString:=Dmodulo.RegistroMadre1.FieldByName('CARGO').AsString;
Dmodulo.Madre1.ParamByName('ACTIVIDADECONOMICA').AsString:=Dmodulo.RegistroMadre1.FieldByName('ACTIV IDADECONOMICA').AsString;
Dmodulo.Madre1.ParamByName('TIPOEMPLEO').AsString:=Dmodulo.RegistroMadre1.FieldByName('TIPOEMPLEO'). AsString;

Dmodulo.Madre1.ParamByName('DIRECCION').AsString:=Dmodulo.RegistroMadre1.FieldByName('DIRECCION').As String;

Dmodulo.Madre1.ParamByName('CUENTAINDICAR').AsString:=Dmodulo.RegistroMadre1.FieldByName('CUENTAINDI CAR').AsString;
Dmodulo.Madre1.ParamByName('OFICINAINDICAR').AsString:=Dmodulo.RegistroMadre1.FieldByName('OFICINAIN DICAR').AsString;

Dmodulo.Madre1.ParamByName('CODIGOBANCO').AsString:=Dmodulo.RegistroMadre1.FieldByName('CODIGOBANCO' ).AsString;

//Dmodulo.Madre1.ParamByName('FECHAINGRESO').AsDate:=Dmodulo.RegistroMadre1.ParamByName('FECHAINGRESO' ).AsDate;
Dmodulo.Madre1.ParamByName('CODIGOAREAOFICINA').AsString:=Dmodulo.RegistroMadre1.FieldByName('CODIGO AREAOFICINA').AsString;
Dmodulo.Madre1.ParamByName('TLFOFICINA').AsString:=Dmodulo.RegistroMadre1.FieldByName('TLFOFICINA'). AsString;

Dmodulo.Madre1.ParamByName('CUENTA').AsString:=Dmodulo.RegistroMadre1.FieldByName('CUENTA').AsString ;
Dmodulo.Madre1.ParamByName('NUMEROCUENTA').AsString:=Dmodulo.RegistroMadre1.FieldByName('NUMEROCUENT A').AsString;

Dmodulo.Madre1.ParamByName('MUNICIPIO').AsString:=Dmodulo.RegistroMadre1.FieldByName('MUNICIPIO').As String;
Dmodulo.Madre1.ParamByName('PARROQUIA').AsString:=Dmodulo.RegistroMadre1.FieldByName('PARROQUIA').As String;
Dmodulo.Madre1.ParamByName('CODIGOCOLEGUIO').AsString:=Dmodulo.RegistroMadre1.FieldByName('CODIGOCOL EGUIO').AsString;
Dmodulo.Madre1.ParamByName('NOMBRECOLEGUIO').AsString:=Dmodulo.RegistroMadre1.FieldByName('NOMBRECOL EGUIO').AsString;


Dmodulo.Madre1.ExecSQL;
Dmodulo.ibt.Commit;
Dmodulo.Madre1.SelectSQL.clear;
Dmodulo.Madre1.SelectSQL.Text:=('select * from Madre ');
Dmodulo.Madre1.Open;
SHOWMESSAGE('A sido Insertado');
end;
{ Dmodulo.RegistroMadre1.SelectSQL.clear;
Dmodulo.RegistroMadre1.SelectSQL.Text:=('delete from RegistroMadre');
Dmodulo.RegistroMadre1.ExecSQL;
Dmodulo.RegistroMadre1.SelectSQL.clear;
Dmodulo.RegistroMadre1.SelectSQL.Text:=('select * from RegistroMadre');
Dmodulo.RegistroMadre1.Open;
}
end;
end;