Página 1 de 1

Error en ODBC ( Faltaba el PRG)

Publicado: Sab Jun 24, 2006 9:59 pm
por Martin del Angel[1]
/*
* Proyecto: Ventas
* Fichero: PolizaContado.prg
* Descripción:
* Autor:
* Fecha: 06-21-2006
*/
#include "Xailer.ch"
#include 'Ado.ch'
CLASS TPolizaContado FROM TForm
COMPONENT oPanel1
COMPONENT oLabelFecha
COMPONENT oFECHA
COMPONENT oLabel2
COMPONENT oMaskEdit1
COMPONENT oSplitter1
COMPONENT oPanel2
COMPONENT oSplitter2
COMPONENT oDATA
COMPONENT oBrowseVendet
COMPONENT oPanel3
COMPONENT oBtnProcesar
COMPONENT oBtnNuevaConsulta
COMPONENT oPanel4
COMPONENT oBevel1
COMPONENT oMensaje
DATA oDataSet
METHOD CreateForm()
METHOD FormInitialize( oSender )
METHOD FECHAExit( oSender, oNextCtl )
METHOD FormClose( oSender, @lClose )
METHOD BtnProcesarClick( oSender )
METHOD BtnNuevaCons( oSender )
METHOD UpdLabel()
ENDCLASS
#include "PolizaContado.xfm"
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TPolizaContado
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FECHAExit( oSender, oNextCtl ) CLASS TPolizaContado
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD FormClose( oSender, lClose ) CLASS TPolizaContado
::oDATA:lConnected:=.f.
::OBrowseVendet:oDataSet:End()
::OBrowseVendet:oDataSet:=NIL
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD BtnProcesarClick( oSender ) CLASS TPolizaContado
local cTable
local nFor
::oDATA:lConnected := !::oDATA:lConnected
if ::oDATA:lConnected
::oBtnProcesar:lEnabled:=.f.
::oBtnNuevaConsulta:lEnabled:=.t.
endif
cTable := 'Vendet'
with object ::oMensaje
:cText := "Leyendo Datos de Base de Datos, Favor de esperer... "
end with
if ::oBrowseVendet:oDataSet != nil
::oBrowseVendet:oDataSet:End()
::oBrowseVendet:oDataSet := nil
endif
If " " $ cTable
::oDataSet := ::oDATA:NewDataSet( "Select * from [" + cTable + "]" )
else
::oDataSet := ::oDATA:NewDataSet( "Select * from " + cTable + " where
fechavtasinhora='12/01/2005'" )
Endif
with object ::oDataSet
:lAsynFetch :=.F. // ::oChkAsyn:lChecked
:OnComplete := {|| ::UpdLabel() }
:Open()
end with
with object ::oBrowseVendet
:oDataSet := ::oDataSet
end with
* MSGINFO(::oDATASET:cNAME)
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD BtnNuevaCons( oSender ) CLASS TPolizaContado
::oDATA:lConnected := !::oDATA:lConnected
if ::oBrowseVendet:oDataSet != nil
::oBrowseVendet:oDataSet:End()
::oBrowseVendet:oDataSet := nil
::oMensaje:cText := ""
::oBtnProcesar:lEnabled:=.t.
::oBtnNuevaConsulta:lEnabled:=.f.
::oFecha:SetFocus()
endif
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD UpdLabel() CLASS TPolizaContado
local aKeys
local cKeys := ""
local n
with object ::oMensaje
:cText := "Registros Leidos " + ltrim( Transform(
::oDataSet:RecCount(), "999,999,999" ) ) + " con " +;
ltrim( Str( Len( ::oDataSet:aFields ) ) ) +" Campos. (" + ;
ltrim( Transform( ::oDataSet:RecCount() * Len(
::oDataSet:aFields ), "9,999,999" ) ) + ;
" values)"
end with
aKeys := ::oDataSet:GetPrimaryKeys()
For n := 1 to Len( aKeys )
cKeys += aKeys[ n ]
if n < Len( aKeys )
cKeys += " , "
endif
Next
If Empty( cKeys )
cKeys := "[Sin definir o inaccesible]"
Endif
* ::oEdiPrKey:Value := cKeys
RETURN nil