Nothing.
Nothing is wrong.
It''s just the normal behaviour - ADO specific.
It seems to me, that .RecordCount won't work
with Server Side Cursors - even with MS SQL Server.
Why is that?
IMHO - ADO doesn't know the exact number of records
in your recordset because with server side cursors
you get (let's say "download") only one row to client at time
so ADO doesn't know how much records are left on the server.
Nothice, that with Client Side recordsets all the records are immediately
returned to client and ADO gets the opportunity to count them.
The only way to count records with server cursors I see is to
call SELECT COUNT(*) from table name. It will work.
It is only my private opinion , so I may be wrong.
A little off topic....

>         rs.Open strSQL, cndb, adOpenDynamic, adLockOptimistic
There is a little mistake, although it works. I'll suggest
a little optimization by using

rs.Open strSQL, cndb, adOpenDynamic, adLockOptimistic, adCmdText

Now, ADO knows that the first argument is SQL text query.
Otherwise it tries to call
1. "SELECT * FROM "& strSQL
2. "CALL {" & strSQL "}"
And eventually tries to call it as simple SQL Query.
 Funny, isn't it? But extremely inefficient.
You can check it with ODBC- SQL Tracer.

Marcin

U�ytkownik "Hagen Schl�mer" <[EMAIL PROTECTED]> napisa� w wiadomo�ci
news:[EMAIL PROTECTED]
> Hi!
>
> How i can get the recordcount of a updateable table in ado with
> serverside-cursors? Is "OpenDynamic/LockOptimistic" usable?
>
> example:
>
>         strSQL = "select * from tableName where IDCol=" & ueIDcol    '
> Select single line
>         rs.Open strSQL, cndb, adOpenDynamic, adLockOptimistic
>         If rs.RecordCount > 0 Then
>             rs("col1") = value1
>             ...
>             ...
>         rs.Update
>         End If
>         rs.Close
>
>    This fails, it uses clientside-cursors and the error is "table
> unknown"(?!) The error occors on update statement.
>
> If i set the cursor location to server-side before the recordset is open,
> then recordcount is erverytime -1.
>
> Whats wrong?
>
> Regards
> Hagen Schloemer



_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to