Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to get a recordcount using ASP and Oracle

56 views
Skip to first unread message

shawn carter

unread,
Sep 6, 2001, 6:59:37 PM9/6/01
to
Everytime in an ASP page I try to get a record count I get
an -1. I am connecting an Oracle db. I can get a
recordcount back if I use VB not on ASP. does any one know
why?

Eric Garza

unread,
Sep 6, 2001, 8:22:38 PM9/6/01
to
Request a Static or Keyset cursor.

Changing CursorLocation to adUseClient implicitly forces a static cursor.

--
Regards,
Eric Garza, MVP
Project manager
AMI GE


"shawn carter" <shawn...@netscape.net> wrote in message
news:1d15801c13727$9a876020$9ae62ecf@tkmsftngxa02...

Kalicanin Goran

unread,
Sep 7, 2001, 3:05:10 AM9/7/01
to
Hi.

The problem is because in most cases (and Oracle is one of them) with server
side cursor you can not get number of records. This is because the server
can not tell you the number of rows until they are all fetched.
So there are two ways to solve this. One way is to stay with server side
cursor and fetch all the rows - just call Move Last method of the recordset
(I suppose that you will cal MoveFirst immediately after this).
Other solution is to use ClientSide cursor which will fetch all the records
on the client side by default.

I hope this will help you
Goran

"shawn carter" <shawn...@netscape.net> wrote in message
news:1d15801c13727$9a876020$9ae62ecf@tkmsftngxa02...

Shawn Carter

unread,
Sep 7, 2001, 10:42:38 AM9/7/01
to
Thabks foe the help, But I have tried everything that you
guys have suggested before I posted the message and I
still cant get a recountcount back. I know I can always
use sql to get a count but that takes 2 calls to the
server. Below is the code I used. When i specify a
cursor location I get an error
"Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another."

when I try to fetch last then first I get an error

"Microsoft OLE DB Provider for Oracle (0x80040E24)
Rowset does not support fetching backward."
Is this a driver problem? Any Information would be great
Thanks
Shawn


set cn = server.CreateObject("ADODB.Connection")
cn.Open session("ORCA_ConnectionString")

set rs = server.CreateObject("ADODB.Recordset")

rs.Open sSearchSql,cn,adOpenStatic


if rs.BOF and rs.EOF then
' records search again
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio
6.0">
</HEAD>
<BODY>
<B>NO RECORDS RETURNED</b>
<% else %>
<textarea rows= 10 cols=50 id=textarea1 name=textarea1><%
=sSearchSql%></textarea>
<FONT SIZE="+1">
RecordCount <B><%=rs.RecordCount %></B>

>.
>

Eric Garza

unread,
Sep 7, 2001, 1:09:17 PM9/7/01
to
Shawn, could you try this?

set rs = server.CreateObject("ADODB.Recordset")

rs.CursorType = adOpenStatic
rs.Open sSearchSql,cn

or

set rs = server.CreateObject("ADODB.Recordset")

rs.CursorLocation = adUseClient
rs.Open sSearchSql,cn

--
Regards,
Eric Garza, MVP
Project manager
AMI GE


"Shawn Carter" <shawn....@netscape.net> wrote in message
news:1d62c01c137ab$56ea8570$9be62ecf@tkmsftngxa03...

Steve Parker

unread,
Sep 7, 2001, 1:47:10 PM9/7/01
to
Shawn,

Do you have the ado constants defined on your page or are you including
adovbs.inc? If not adOpenStatic, adUseClient, etc. are not defined.

Steve

"Shawn Carter" <shawn....@netscape.net> wrote in message
news:1d62c01c137ab$56ea8570$9be62ecf@tkmsftngxa03...

Shawn

unread,
Sep 14, 2001, 8:29:47 PM9/14/01
to

Steve

Thanks for the advice I included the adovbs.inc in the
page and it works like a charm now. Thanks again

Thanks
Shawn

0 new messages