Pregunta de ADO

Pregunta de ADO

Postby ruben Dario » Fri Mar 22, 2013 9:10 pm

Tenga una inquietud , tengo diseñado un formulario , cuando navego avanzo a otro registro solamente me llega hasta el record 15 y parece que este fuera el final del archivo , pero en realidad la base de datos tiene mas de 1000
Hay algun parametro en ADO que me esta bloqueando los demas registros,

Asi Hago la Conexion

Code: Select all  Expand view

Function Conectar()
Local Retorno:=.F.
LOCAL rs, oErr,oCs
local odbcli
Local cSelect
//Public oCn
   TRY
      oApp:oServer:= CreateObject( "ADODB.Connection" )
      oApp:oServer:Open(oApp:oConexion)

      oApp:oADOoSql:=TOleAuto():New("ADODB.Command")
      oApp:oADOoSql:CommandType     := adCmdText
      oApp:oADOoSql:ActiveConnection:= oApp:oServer

      Retorno:=.T.
   CATCH oErr
      MSGAlert("Error : No se tiene acceso al servidor " + CRLF +;
               "por favor verifique conexion a red o que el servidor este funcionando", ;
               "Error: " + oErr:Operation + " -> " + oErr:Description )
      Retorno:=.F.
   END
Return Retorno
 


y para tipo record asi.

Code: Select all  Expand view

   local oErrorAdo
   local oErrorCmd
   Local nTime1:=seconds()
   Local oRcs

   DEFAULT cSelect        := ("select * from " + ALLTRIM(cTable))
   DEFAULT LockType       :=adLockOptimistic
   DEFAULT CursorLocation :=adUseClient
   DEFAULT CursorType     :=adOpenDynamic
   DEFAULT lPaged         :=.F.
   cTable  := Lower(cTable)  // Lo coloco Ruben UPPER mayuscula Lower --> Minuscula
   ::lBuffer        :=.T.
   ::lOemAnsi       :=.F.
   ::cSelect        :=Lower(cSelect)
   ::cTable         :=cTable
   ::oCon           :=oConnect
   ::LockType       :=LockType
   ::CursorLocation :=CursorLocation
   ::CursorType     :=CursorType
   ::lPaged         :=lPaged


   If !IfTable(cTable,oConnect)
      MsgAlert("Error : " + Alltrim( cTable ) + " No Existe !!!","Verifique Nombre de Tabla" )
      ::lExists:=.F.
      Return Self
   Endif

      ::TableRecCount()
   If ::lPaged=.T.
      ::Inicia()
   Else
      oRcs:=TOleAuto():New("ADODB.recordset")
      oRcs:CursorLocation:= CursorLocation
      oRcs:CacheSize     := ::nPageSize
      oRcs:PageSize      := ::nPageSize

      TRY
        oRcs:Open(cSelect,oConnect,CursorType,LockType)  //1,3 )
      CATCH oErrorAdo
            ShowError(oErrorAdo,"New ADOBASE")
      END

      ::oRcs := oRcs
   Endif

   ::tElapsed:= (Seconds() -nTime1)

   If ::oRcs:CursorLocation = 3  // adUseClient
      ::oRcs:Properties("Unique Table"):Value := cTable
   Endif

    //Try
          ::nFields:=::oRcs:Fields:Count
    //Catch oErrorAdo
    //      ShowError(oErrorAdo,"Field Count")
    //End

   ::aBuffer:=Array( ::nFields )
   ::Struct()
   ::Load()

   ::aFldNames := {}
   For n = 1 To ( ::nFields )
       AAdd( ::aFldNames, upper( ::FieldName( n-1 )) ) //AAdd( ::aFldNames, ::FieldName( n-1 ) ) // Ruben
   Next

 
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
ruben Dario
 
Posts: 1061
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Pregunta de ADO

Postby nnicanor » Fri Mar 22, 2013 10:18 pm

Ruben,

Por que utilizas un array si te puedes mover perfectamente con los metodos MoveNext, MovePrevius MoveFirts y MoveLast ??

Slds
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 295
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 45 guests