Newsgroup: it.comp.www.asp
Titolo: recordcount

Ho un problemino a contare i record di una tabella:
il codice che uso e' questo:
=====================
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & _
"DBQ=" & server.mappath("mega.mdb")
SQL="Select * from PRODOTTI"
Set Rs=Conn.Execute(SQL)
Rs.MoveLast
Rs.MoveFirst
rows = rs.recordcount
=====================
ma mi da quest'errore:
---------------------------
Microsoft OLE DB Provider for ODBC Drivers errore "80040e24"
Il set di righe non supporta il fetch all'indietro.
/aziende/mega/e-comm/prova.asp, riga 6
---------------------------
Sbaglio a settare qualcosa? Dimentico qualcos'altro?
Grazie a tutti.
--
ciao
gelty
--
Visita 
http://www.sifor.it
Elimina *toglimi* per le risposte

semplicemente ..non puoi teornare indietro...
una volta che sei alla fine del recordset non puoi tornare al primo.
potresti usare questo:
SQL="select count (*) as QuantiSono from tabella where....."
Set Rs=Conn.Execute(SQL)
rows=Rs("QuantiSono")
CIAO!!!

 wrote in message
37D77D09...@netscape.net...

Ti ringrazio, ora e' tutto ok.
Anche se in un articolo del sito comune (Database ed ASP: guida rapida
all'uso) e' specificato:
"Dopo aver recuperato i record e' possibile leggerli con i metodi MoveFirst,
MoveLast, MoveNext e MovePrevious".
Pensavo di poterli utilizzare come in VisualBasic.
Vabbe', non vedo l'ora che arrivi il benedetto manuale che ho ordinato...


In realta' e' ADO che non te li fa utilizzare!!!
CIAO e..prego
GL

Il metodo OPEN degli oggetti Connection e Recordset
hanno il paramatro opzionale CURSOR TYPE.
Dei 4 cursori possibili non tutti permettono la
navigazione avanti-indietro nel recorset.
Vedi la seguente pagina che trovi anche sul tuo PC in
http://localhost/IASDocs/ASPDocs/ref/comp/daprop02_7.htm
Saluti,
Davide C.
****************************************************************************
***
CursorType Property
Indicates the type of cursor used in a Recordset object.
Settings and Return Values
Sets or returns one of the following CursorTypeEnum values: Constant
 Value
 Description
adOpenForwardOnly
 0
 Forward-only cursor. Identical to a static cursor except that you can only
scroll forward through records. This improves performance in situations when
you only need to make a single pass through a recordset. (Default.)
adOpenKeyset
 1
 Keyset cursor. Like a dynamic cursor, except that you can't see records
that other users add, although records that other users delete are
inaccessible from your recordset. Data changes by other users are still
visible.
adOpenDynamic
 2
 Dynamic cursor. Additions, changes, and deletions by other users are
visible, and all types of movement through the recordset are allowed, except
for bookmarks if the provider doesn't support them.
adOpenStatic
 3
 Static cursor. A static copy of a set of records that you can use to find
data or generate reports. Additions, changes, or deletions by other users
are not visible.
Remarks
Use the CursorType property to specify the type of cursor that should be
used when opening the Recordset object. The CursorType property is
read/write when the recordset is closed and read-only when it is open.
If a provider does not support the requested cursor type, the provider may
return another cursor type. The CursorType property will change to match the
actual cursor type in use when the Recordset object is open. To verify
specific functionality of the returned cursor, use the Supports method.
After you close the Recordset, the CursorType property reverts to its
original setting.
The following chart shows the functionality of each cursor type with respect
to the Supports method constants. CursorType
 Supports
adOpenForwardOnly
 none
adOpenKeyset
 adBookmark, adHoldRecords, adMovePrevious, adResync
adOpenDynamic
 adMovePrevious
adOpenStatic
 adBookmark, adHoldRecords, adMovePrevious, adResync
Note Although Supports(adUpdateBatch) may be true for dynamic and
forward-only cursors, you should use batch updating only with either a
keyset or static cursor.
Applies To
Recordset
See Also
Supports


^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
Moderatore di it.comp.www.asp
Gruppo di supporto: 
http://www.ASPItalia.com/index.asp?ng
News via web: 
http://www.ASPItalia.com/newsgroup/news/
^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
Vuoi leggere i newsgroup tecnici italiani sul web?
Prova 
http://www.ASPItalia.com/newsgroup/news/