ADO não funciona o RecordCount()?

ADO não funciona o RecordCount()?

Postby ronaldo » Thu Jan 26, 2006 1:43 pm

Ola pessoal, estou trabalhando com o ADO para o ACCESS porem alguns comandos conforme relação abaixo não funciona! sabem porque?

****************************************************
#Include "Fivewin.ch"
Function Main()
LOCAL oDados, txSql
PRIVATE oCn := CREATEOBJECT( "ADODB.Connection" )

oCn:Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=venda.mdb" )
txSql := "SELECT * FROM imovweb; "
oDados := oCn:Execute( txSql)

oDados:MoveNext() -- Funciona
oDados:MoveFirst() -- NÃO Funciona
oDados:MoveLast() -- NÃO Funciona
oDados:RecordCount() -- NÃO Funciona
****************************************************
User avatar
ronaldo
 
Posts: 139
Joined: Fri Nov 25, 2005 4:38 pm
Location: brasil

Re: ADO não funciona o RecordCount()?

Postby Enrico Maria Giordano » Thu Jan 26, 2006 2:13 pm

From the MSDN:

"The returned Recordset object is always a read-only, forward-only cursor."

Use recordsets instead of connections:

Code: Select all  Expand view  RUN
#define adOpenForwardOnly 0
#define adOpenKeyset      1
#define adOpenDynamic     2
#define adOpenStatic      3

#define adLockReadOnly        1
#define adLockPessimistic     2
#define adLockOptimistic      3
#define adLockBatchOptimistic 4


FUNCTION MAIN()

    LOCAL oRs := CREATEOBJECT( "ADODB.Recordset" )

    oRs:Open( "SELECT * FROM Clienti", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clienti.mdb", adOpenKeyset, adLockReadOnly )

    oRs:MoveLast()

    WHILE !oRs:EOF
        ? oRs:Fields( "Cliente" ):Value
        oRs:MoveNext()
    ENDDO

    oRs:Close()

    INKEY( 0 )

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby ronaldo » Thu Jan 26, 2006 3:38 pm

Perfect!

Muito obrigado,
Ronaldo Minacapelli
User avatar
ronaldo
 
Posts: 139
Joined: Fri Nov 25, 2005 4:38 pm
Location: brasil

Postby mauricioajordao » Tue Feb 28, 2006 1:35 am

Hi enrico..

Do you Know , Where Find Mtehods and DATA from this Class..


CREATEOBJECT( "ADODB.Recordset" )


Thanks
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Tue Feb 28, 2006 8:13 am

On the MSDN.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Tue Feb 28, 2006 2:02 pm

Thanks Enrico...

I´m Learn About ADO, But You Can Response Only Two Asks?


First ..

Using ADODB My Systems Are Compatible With win98 , winxp , win2003 ?

Second..

Using ADODB My Systems Required DATABASE registre in ODBC ?
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Tue Feb 28, 2006 3:48 pm

1) WinXP and Win2003: yes. Win98: you will need to install Office or MSDE.

2) No.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Tue Feb 28, 2006 4:00 pm

Thanks Very Much Enrico.



Mauricio
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Wed Mar 01, 2006 4:24 pm

EnricoMaria wrote:1) WinXP and Win2003: yes. Win98: you will need to install Office or MSDE.


Sorry, MDAC not MSDE.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Wed Mar 01, 2006 11:12 pm

Thanks Enrico AGAIN...

i´m modify TCBROWSE to ADO

How Get Field Names of Database Using ADO ?




thanks Mauricio
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Thu Mar 02, 2006 7:53 am

Code: Select all  Expand view  RUN
#define adOpenForwardOnly 0
#define adOpenKeyset      1
#define adOpenDynamic     2
#define adOpenStatic      3

#define adLockReadOnly        1
#define adLockPessimistic     2
#define adLockOptimistic      3
#define adLockBatchOptimistic 4


FUNCTION MAIN()

    LOCAL oCat

    LOCAL i, j

    oCat = CREATEOBJECT( "ADOX.Catalog" )

    oCat:ActiveConnection = "Provider=SQLOLEDB;Integrated Security=SSPI;Data Source=EMAG\Emag;Initial Catalog=Quadro"

    FOR i = 0 TO oCat:Tables:Count() - 1
        ? oCat:Tables( i ):Name
        ?

        FOR j = 0 TO oCat:Tables( i ):Columns:Count() - 1
            ? SPACE( 4 ) + oCat:Tables( i ):Columns( j ):Name
        NEXT

        ?
    NEXT

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Thu Mar 02, 2006 9:27 am

Enrico ,

The Object Change ADO for ADOX because You are Using Extend ADO methods, Thats Right?


The Extende ADO methods are 100% compatible ?




thanks , AGAIN

mauricio
(brazil)
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Thu Mar 02, 2006 10:14 am

mauricioajordao wrote:Enrico ,

The Object Change ADO for ADOX because You are Using Extend ADO methods, Thats Right?


The Extende ADO methods are 100% compatible ?


Yes and yes.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Thu Mar 02, 2006 10:31 am

THANKS AGAIN

MAURICIO
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests