Página 1 de 1

Copiar campos

Publicado: Jue Jun 01, 2006 7:09 pm
por Paco V
Quiero copiar todos loa campos de una DBF a otra DBF
Intento hacer esto:
For n := 1 to 20
::oDbfDataSet2:Fieldput(n):=::oDbfDataSet1:Fieldgetn) next n
Van por aqui los tiros?
Paco V

Copiar campos

Publicado: Jue Jun 01, 2006 7:57 pm
por ignacio
Paco,
oDbfDestino:SaveFrom( oDbfOrigen )
Saludos
"Paco V" <ssi@ono.com> escribió en el mensaje
news:447f1f2d$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>
> Quiero copiar todos loa campos de una DBF a otra DBF
>
> Intento hacer esto:
>
> For n := 1 to 20
> ::oDbfDataSet2:Fieldput(n):=::oDbfDataSet1:Fieldgetn) next n
>
> Van por aqui los tiros?
>
> Paco V

Copiar campos

Publicado: Vie Jun 02, 2006 12:37 am
por Manu Exposito
Como te dice Ignacio copias la tabla como tal sin cambios, incluso podrias
hacer una copia directamente cuando sepas que estan cerradas con la funcion
FileCopy() de CT o wrappeando la del API de windows...
Ahora bien si quieres copiarla de una manera especial controlando tu... si
vas bien encaminado pero lo que tu pones esta erroneo, seria algo asi:
while !::oDbfDataSet1:Eof()
for n := 1 to 20
::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
next
::oDbfDataSet1:Skip()
end
Mas o menos ;-)
"Paco V" <ssi@ono.com> escribió en el mensaje
news:447f1f2d$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>
> Quiero copiar todos loa campos de una DBF a otra DBF
>
> Intento hacer esto:
>
> For n := 1 to 20
> ::oDbfDataSet2:Fieldput(n):=::oDbfDataSet1:Fieldgetn) next n
>
> Van por aqui los tiros?
>
> Paco V

Copiar campos

Publicado: Mié Jun 07, 2006 5:16 pm
por Paco V
Me ha servido las dos opciones, y he hecho esto:
WITH OBJECT oFrm := TForm5():CreateForm( Self )
:cText := "Traspasar AGENTES a Histórico"
::oDbfDataSet1:edit() //Dejo editar para cambiar
:ShowModal()
if :nModalResult == mrOK
::oDbfDataSet2:AddNew()
if ::oDbfDataset2:RecLock()
for n := 1 to 91
::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
next n
:oDbfDataSet2:modi :=APPDATA:usuarop
::oDbfDataSet2:mome :=dtos(date())+"-"+time()+"/A"
::oDbfDataSet2:Update()
::oDbfDataset2:RecUnLock()
endif
endif
:END()
END WITH
Y me falla el bloqueo de registros. ¿Creo que bajo mi lógica esta bien pero
que puede estar mal?
Gracias
Paco V
"Manu Exposito" <messoft@gmail.com> wrote:
>Como te dice Ignacio copias la tabla como tal sin cambios, incluso podrias
>hacer una copia directamente cuando sepas que estan cerradas

Copiar campos

Publicado: Mié Jun 07, 2006 5:47 pm
por ignacio
Paco,
No tiene sentido hacer un Addnew() después de un Edit(). O el uno o el otro,
pero no los dos a la vez.
Un saludo,
"Paco V" <ssi@ono.com> escribió en el mensaje
news:4486edde$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>
> Me ha servido las dos opciones, y he hecho esto:
>
> WITH OBJECT oFrm := TForm5():CreateForm( Self )
> :cText := "Traspasar AGENTES a Histórico"
> ::oDbfDataSet1:edit() //Dejo editar para cambiar
> :ShowModal()
> if :nModalResult == mrOK
> ::oDbfDataSet2:AddNew()
> if ::oDbfDataset2:RecLock()
> for n := 1 to 91
> ::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
> next n
> :oDbfDataSet2:modi :=APPDATA:usuarop
> ::oDbfDataSet2:mome :=dtos(date())+"-"+time()+"/A"
> ::oDbfDataSet2:Update()
> ::oDbfDataset2:RecUnLock()
> endif
> endif
> :END()
> END WITH
>
> Y me falla el bloqueo de registros. ¿Creo que bajo mi lógica esta bien
> pero
> que puede estar mal?
>
> Gracias
> Paco V
>
>
> "Manu Exposito" <messoft@gmail.com> wrote:
>>Como te dice Ignacio copias la tabla como tal sin cambios, incluso podrias
>
>>hacer una copia directamente cuando sepas que estan cerradas

Copiar campos

Publicado: Mié Jun 07, 2006 6:15 pm
por Paco V
El edit va sobre ::odBfDataSet1
y despues addnew lo hago sobre ::odBfDataSet2
Es correcto?
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote:
>Paco,
>
>No tiene sentido hacer un Addnew() después de un Edit(). O el uno o el otro,
>pero no los dos a la vez.
>
>Un saludo,
>
>"Paco V" <ssi@ono.com> escribió en el mensaje
>news:4486edde$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>>
>> Me ha servido las dos opciones, y he hecho esto:
>>
>> WITH OBJECT oFrm := TForm5():CreateForm( Self )
>> :cText := "Traspasar AGENTES a Histórico"
>> ::oDbfDataSet1:edit() //Dejo editar para cambiar
>> :ShowModal()
>> if :nModalResult == mrOK
>> ::oDbfDataSet2:AddNew()
>> if ::oDbfDataset2:RecLock()
>> for n := 1 to 91
>> ::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
>> next n
>> :oDbfDataSet2:modi :=APPDATA:usuarop
>> ::oDbfDataSet2:mome :=dtos(date())+"-"+time()+"/A"
>> ::oDbfDataSet2:Update()
>> ::oDbfDataset2:RecUnLock()
>> endif
>> endif
>> :END()
>> END WITH
>>
>> Y me falla el bloqueo de registros. ¿Creo que bajo mi lógica esta bien
>> pero
>> que puede estar mal?
>>
>> Gracias
>> Paco V
>>
>>
>> "Manu Exposito" <messoft@gmail.com> wrote:
>>>Como te dice Ignacio copias la tabla como tal sin cambios, incluso podrias
>>
>>>hacer una copia directamente cuando sepas que estan cerradas
>
>

Copiar campos

Publicado: Mié Jun 07, 2006 8:29 pm
por ignacio
Paco,
Entiendo. No me habí­a fijado que eran distintos DataSets.
Este código
>>> if :nModalResult == mrOK
>>> ::oDbfDataSet2:AddNew()
>>> if ::oDbfDataset2:RecLock()
>>> for n := 1 to 91
>>> ::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
>>> next n
>>> :oDbfDataSet2:modi :=APPDATA:usuarop
>>> ::oDbfDataSet2:mome :=dtos(date())+"-"+time()+"/A"
>>> ::oDbfDataSet2:Update()
>>> ::oDbfDataset2:RecUnLock()
se debe sustituir por este:
if :nModalResult == mrOK
WITH OBJECT ::oDbfDataSet2
:AddNew()
for n := 1 to 91
:VarPut(n, ::oDbfDataSet1:Fieldget(n) )
next n
:modi :=APPDATA:usuarop
:mome :=dtos(date())+"-"+time()+"/A"
:Update()
END WITH
Endif
Saludos
"Paco V" <ssi@ono.com> escribió en el mensaje news:4486fbbd$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>
> El edit va sobre ::odBfDataSet1
> y despues addnew lo hago sobre ::odBfDataSet2
>
> Es correcto?
>
>
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> wrote:
>>Paco,
>>
>>No tiene sentido hacer un Addnew() después de un Edit(). O el uno o el otro,
>
>>pero no los dos a la vez.
>>
>>Un saludo,
>>
>>"Paco V" <ssi@ono.com> escribió en el mensaje
>>news:4486edde$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>>>
>>> Me ha servido las dos opciones, y he hecho esto:
>>>
>>> WITH OBJECT oFrm := TForm5():CreateForm( Self )
>>> :cText := "Traspasar AGENTES a Histórico"
>>> ::oDbfDataSet1:edit() //Dejo editar para cambiar
>>> :ShowModal()
>>> if :nModalResult == mrOK
>>> ::oDbfDataSet2:AddNew()
>>> if ::oDbfDataset2:RecLock()
>>> for n := 1 to 91
>>> ::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
>>> next n
>>> :oDbfDataSet2:modi :=APPDATA:usuarop
>>> ::oDbfDataSet2:mome :=dtos(date())+"-"+time()+"/A"
>>> ::oDbfDataSet2:Update()
>>> ::oDbfDataset2:RecUnLock()
>>> endif
>>> endif
>>> :END()
>>> END WITH
>>>
>>> Y me falla el bloqueo de registros. ¿Creo que bajo mi lógica esta bien
>
>>> pero
>>> que puede estar mal?
>>>
>>> Gracias
>>> Paco V
>>>
>>>
>>> "Manu Exposito" <messoft@gmail.com> wrote:
>>>>Como te dice Ignacio copias la tabla como tal sin cambios, incluso podrias
>>>
>>>>hacer una copia directamente cuando sepas que estan cerradas
>>
>>
>
--

Copiar campos

Publicado: Jue Jun 08, 2006 10:26 am
por Paco V
Ignacio:
Como Siempre, mucho mas sencillo y funciona mejor.
Gracias por tu tiempo.
Paco V
=?iso-8859-1?Q?Ignacio_Ortiz_de_Z=FA=F1iga?= <NoName@xailer.com> wrote:
>
>
>Paco,=20
>
>Entiendo. No me hab=EDa fijado que eran distintos DataSets.=20
>
>Este c=F3digo=20
>
>>>> if :nModalResult =3D=3D mrOK
>>>> ::oDbfDataSet2:AddNew()
>>>> if ::oDbfDataset2:RecLock()
>>>> for n :=3D 1 to 91
>>>> ::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
>>>> next n
>>>> :oDbfDataSet2:modi :=3DAPPDATA:usuarop
>>>> ::oDbfDataSet2:mome :=3Ddtos(date())+"-"+time()+"/A"
>>>> ::oDbfDataSet2:Update()
>>>> ::oDbfDataset2:RecUnLock()
>
>se debe sustituir por este:
>
>if :nModalResult =3D=3D mrOK
> WITH OBJECT ::oDbfDataSet2
> :AddNew()
> for n :=3D 1 to 91
> :VarPut(n, ::oDbfDataSet1:Fieldget(n) )
> next n
> :modi :=3DAPPDATA:usuarop
> :mome :=3Ddtos(date())+"-"+time()+"/A"
> :Update()
> END WITH
>Endif
>
>Saludos
>
>"Paco V" <ssi@ono.com> escribi=F3 en el mensaje =
>news:4486fbbd$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>>=20
>> El edit va sobre ::odBfDataSet1
>> y despues addnew lo hago sobre ::odBfDataSet2
>>=20
>> Es correcto?
>>=20
>>=20
>>=20
>> "Ignacio Ortiz de Z=FA=F1iga" <NoName@xailer.com> wrote:
>>>Paco,
>>>
>>>No tiene sentido hacer un Addnew() despu=E9s de un Edit(). O el uno o
=
>el otro,
>>=20
>>>pero no los dos a la vez.
>>>
>>>Un saludo,
>>>
>>>"Paco V" <ssi@ono.com> escribi=F3 en el mensaje=20
>>>news:4486edde$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
>>>>
>>>> Me ha servido las dos opciones, y he hecho esto:
>>>>
>>>> WITH OBJECT oFrm :=3D TForm5():CreateForm( Self )
>>>> :cText :=3D "Traspasar AGENTES a Hist=F3rico"
>>>> ::oDbfDataSet1:edit() //Dejo editar para cambiar
>>>> :ShowModal()
>>>> if :nModalResult =3D=3D mrOK
>>>> ::oDbfDataSet2:AddNew()
>>>> if ::oDbfDataset2:RecLock()
>>>> for n :=3D 1 to 91
>>>> ::oDbfDataSet2:Fieldput(n, ::oDbfDataSet1:Fieldget(n) )
>>>> next n
>>>> :oDbfDataSet2:modi :=3DAPPDATA:usuarop
>>>> ::oDbfDataSet2:mome :=3Ddtos(date())+"-"+time()+"/A"
>>>> ::oDbfDataSet2:Update()
>>>> ::oDbfDataset2:RecUnLock()
>>>> endif
>>>> endif
>>>> :END()
>>>> END WITH
>>>>
>>>> Y me falla el bloqueo de registros. =BFCreo que bajo mi l=F3gica =
>esta bien
>>=20
>>>> pero
>>>> que puede estar mal?
>>>>
>>>> Gracias
>>>> Paco V
>>>>
>>>>
>>>> "Manu Exposito" <messoft@gmail.com> wrote:
>>>>>Como te dice Ignacio copias la tabla como tal sin cambios, incluso =
>podrias
>>>>
>>>>>hacer una copia directamente cuando sepas que estan cerradas=20
>>>
>>>
>>
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><HTML><HEAD>
><META http-equiv=3DContent-Type content=3D"text/html; =
>charset=3Diso-8859-1">
><META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
><STYLE></STYLE>
></HEAD>
><BODY>
><DIV><FONT face=3DArial size=3D2>Paco, </FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2>Entiendo. No me hab=EDa fijado que eran
=
>distintos=20
>DataSets. </FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2>Este c=F3digo </FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2>>>> if :nModalResult =3D=3D=20
>mrOK<BR>>>>  ::oDbfDataSet2:AddNew()<BR>>>>  =
>if=20
>::oDbfDataset2:RecLock()<BR>>>>   for n :=3D 1 to=20
>91<BR>>>>    ::oDbfDataSet2:Fieldput(n,=20
>::oDbfDataSet1:Fieldget(n) )<BR>>>>   next=20
>n<BR>>>>   :oDbfDataSet2:modi=20
>:=3DAPPDATA:usuarop<BR>>>>   ::oDbfDataSet2:mome=20
>:=3Ddtos(date())+"-"+time()+"/A"<BR>>>>  =20
>::oDbfDataSet2:Update()<BR>>>>  =20
>::oDbfDataset2:RecUnLock()<BR></FONT></DIV>
><DIV><FONT face=3DArial size=3D2>se debe sustituir por =
>este:</FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2><FONT face=3D"Courier New">if =
>:nModalResult =3D=3D=20
>mrOK</FONT></FONT></DIV>
><DIV><FONT face=3DArial size=3D2><FONT face=3D"Courier =
>New">    WITH=20
>OBJECT ::oDbfDataSet2<BR>       =20
>:AddNew()<BR>        for n :=3D 1 to=20
>91<BR>            =
>:VarPut(n,=20
>::oDbfDataSet1:Fieldget(n) )</FONT></FONT></DIV>
><DIV><FONT face=3DArial size=3D2><FONT face=3D"Courier =
>New">    =20
>   next =
>n<BR>        :modi=20
>:=3DAPPDATA:usuarop<BR>        :m=
>ome=20
>:=3Ddtos(date())+"-"+time()+"/A"<BR>      &=
>nbsp; :Update()<BR>   =20
>END WITH</FONT></FONT></DIV>
><DIV><FONT face=3DArial size=3D2><FONT face=3D"Courier =
>New">Endif</FONT></FONT></DIV>
><DIV><FONT face=3DArial size=3D2><FONT face=3D"Courier =
>New"></FONT></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2><FONT=20
>face=3D"Courier New">Saludos</FONT></DIV></FONT>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2>"Paco V" <</FONT><A=20
>href=3D"mailto:ssi@ono.com"><FONT face=3DArial =
>size=3D2>ssi@ono.com</FONT></A><FONT=20
>face=3DArial size=3D2>> escribi=F3 en el mensaje </FONT><A=20
>href=3D"news:4486fbbd$1@ozsrvnegro.ozlan.local"><FONT face=3DArial=20
>size=3D2>news:4486fbbd$1@ozsrvnegro.ozlan.local</FONT></A><FONT =
>face=3DArial=20
>size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> <BR>> El =
>edit va sobre=20
>::odBfDataSet1<BR>> y despues addnew  lo hago sobre=20
>::odBfDataSet2<BR>> <BR>> Es correcto?<BR>> <BR>> <BR>> =
><BR>>=20
>"Ignacio Ortiz de Z=FA=F1iga" <</FONT><A =
>href=3D"mailto:NoName@xailer.com"><FONT=20
>face=3DArial size=3D2>NoName@xailer.com</FONT></A><FONT face=3DArial =
>size=3D2>>=20
>wrote:<BR>>>Paco,<BR>>><BR>>>No tiene sentido hacer un =
>
>Addnew() despu=E9s de un Edit(). O el uno o el otro,<BR>> =
><BR>>>pero no=20
>los dos a la vez.<BR>>><BR>>>Un =
>saludo,<BR>>><BR>>>"Paco=20
>V" <</FONT><A href=3D"mailto:ssi@ono.com"><FONT face=3DArial=20
>size=3D2>ssi@ono.com</FONT></A><FONT face=3DArial size=3D2>> =
>escribi=F3 en el mensaje=20
><BR>>>news:4486edde$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]<BR>>>><BR>=
>>>>=20
>Me ha servido las dos opciones, y he hecho =
>esto:<BR>>>><BR>>>>=20
>WITH OBJECT oFrm :=3D TForm5():CreateForm( Self )<BR>>>> :cText =
>:=3D=20
>"Traspasar AGENTES a Hist=F3rico"<BR>>>>=20
>::oDbfDataSet1:edit()    //Dejo editar para=20
>cambiar<BR>>>> :ShowModal()<BR>>>> if :nModalResult =
>=3D=3D=20
>mrOK<BR>>>>  ::oDbfDataSet2:AddNew()<BR>>>>  =
>if=20
>::oDbfDataset2:RecLock()<BR>>>>   for n :=3D 1 to=20
>91<BR>>>>    ::oDbfDataSet2:Fieldput(n,=20
>::oDbfDataSet1:Fieldget(n) )<BR>>>>   next=20
>n<BR>>>>   :oDbfDataSet2:modi=20
>:=3DAPPDATA:usuarop<BR>>>>   ::oDbfDataSet2:mome=20
>:=3Ddtos(date())+"-"+time()+"/A"<BR>>>>  =20
>::oDbfDataSet2:Update()<BR>>>>  =20
>::oDbfDataset2:RecUnLock()<BR>>>>  endif<BR>>>>=20
>endif<BR>>>> :END()<BR>>>> END=20
>WITH<BR>>>><BR>>>> Y me falla el bloqueo de registros. =
>=BFCreo=20
>que bajo mi l=F3gica esta bien<BR>> <BR>>>> =
>pero<BR>>>> que=20
>puede estar mal?<BR>>>><BR>>>> Gracias<BR>>>> =
>Paco=20
>V<BR>>>><BR>>>><BR>>>> "Manu Exposito" =
><</FONT><A=20
>href=3D"mailto:messoft@gmail.com"><FONT face=3DArial=20
>size=3D2>messoft@gmail.com</FONT></A><FONT face=3DArial size=3D2>>=20
>wrote:<BR>>>>>Como te dice Ignacio copias la tabla como tal =
>sin=20
>cambios, incluso podrias<BR>>>><BR>>>>>hacer una =
>copia=20
>directamente cuando sepas que estan cerradas=20
><BR>>><BR>>><BR>></FONT></BODY></HTML>
>
>