ADO and ASP

ADO and ASP

Post by Interne » Thu, 27 Jan 2000 04:00:00



Hi All,

I am using ADO to connect to a SQL Server 7.0 database to extract read only
recordsets. I call stored procedures to populate the recordsets. Apparantly
every time I use MOVEFIRST to go to the first record of the recordset the
page is re-calling the stored procedure. The data I am extracting never
changes and I will not be updating the data.

I never thought that a MoveFirst on a recordset eould call the Query/ Stored
Procedure again. Is there any way to prevent this happening ? I am using the
default locking and Cursor types. Is this wrong ?

This is pretty urgent so any help would be appreciated,

Paul

 
 
 

ADO and ASP

Post by Frank Figearo, MCSD, MC » Thu, 27 Jan 2000 04:00:00


The default cursor type for an ADO recordset is forward-only. This means
that the only move operation you should be able to do is a MoveFirst (or any
one that doesn't move backwards). You can verify this by trying a
MovePrevious on your recordset. You'll get a runtime error.

However, I've documented a peculiar quirk with the forward-only server-side
cursor. If you call MoveFirst, instead of throwing an error, ADO will re-run
the query. I believe that if you try this with a forward-only client-side
cursor, you'll get the expected error message.

The solution to your problem is to use the appropreate cursor. ADO offers
several, but I believe the static cursor will do the trick. For more
information search titles on "CursorType Property" in the MSDN Library.

--
Frank Figearo, MCSD, MCT


Quote:> Hi All,

> I am using ADO to connect to a SQL Server 7.0 database to extract read
only
> recordsets. I call stored procedures to populate the recordsets.
Apparantly
> every time I use MOVEFIRST to go to the first record of the recordset the
> page is re-calling the stored procedure. The data I am extracting never
> changes and I will not be updating the data.

> I never thought that a MoveFirst on a recordset eould call the Query/
Stored
> Procedure again. Is there any way to prevent this happening ? I am using
the
> default locking and Cursor types. Is this wrong ?

> This is pretty urgent so any help would be appreciated,

> Paul


 
 
 

ADO and ASP

Post by Joost Devo » Fri, 28 Jan 2000 04:00:00


I think having read somewhere in the docs, that for that type of cursor,
.MoveFirst is requering the database sp "by design"...

correct me if I'm wrong
Joost Devos



> The default cursor type for an ADO recordset is forward-only. This means
> that the only move operation you should be able to do is a MoveFirst (or
any
> one that doesn't move backwards). You can verify this by trying a
> MovePrevious on your recordset. You'll get a runtime error.

> However, I've documented a peculiar quirk with the forward-only
server-side
> cursor. If you call MoveFirst, instead of throwing an error, ADO will
re-run
> the query. I believe that if you try this with a forward-only client-side
> cursor, you'll get the expected error message.

> The solution to your problem is to use the appropreate cursor. ADO offers
> several, but I believe the static cursor will do the trick. For more
> information search titles on "CursorType Property" in the MSDN Library.

> --
> Frank Figearo, MCSD, MCT



> > Hi All,

> > I am using ADO to connect to a SQL Server 7.0 database to extract read
> only
> > recordsets. I call stored procedures to populate the recordsets.
> Apparantly
> > every time I use MOVEFIRST to go to the first record of the recordset
the
> > page is re-calling the stored procedure. The data I am extracting never
> > changes and I will not be updating the data.

> > I never thought that a MoveFirst on a recordset eould call the Query/
> Stored
> > Procedure again. Is there any way to prevent this happening ? I am using
> the
> > default locking and Cursor types. Is this wrong ?

> > This is pretty urgent so any help would be appreciated,

> > Paul

 
 
 

1. ASP with ADO Error ASP 0115

Hi,

I have an ASP application running that uses ADO to access an DB2/400
database.

The problem I am having is that when the script runs the .seek method on a
recordset I get the error :
--------------------------------
error 'ASP 0115'
Unexpected error

/CFListTypes.asp

A trappable error occurred in an external object. The script cannot continue
running.

----------------------------------------------

Once I receive this error once all asp using the ADO objects on the server
then bring up the same error (where they were working before) until I
restart the IIS services.

I have run a VB app with the equavalent code in it to test the access to the
AS/400 using these methods and that works fine.

I've looked on the AS/400 and can see the job start, but it just ends with
no error codes, joblogs, etc.

My questions are:

Why should one error cause all ADO access to stop working ?

How can I get some more information about what might be going wrong ?

I am using IIS on NT4.0 SP6 machine with ADO MDAC 2.5 SP2 (2.52.6019.2) on
the server with the AS/400 OLE DB provider that comes with Client Access/400
v5r1.

=============================================

Code in error:

'Create connection objects

Set objCnn = Server.CreateObject("ADODB.Connection")

Set objErr = Server.CreateObject("ADODB.Error")

Set objRst = Server.CreateObject("ADODB.Recordset")

'Connect to the AS/400

strAS400Name = Trim(Request.QueryString("AS400Name"))

strConnect = "Provider=IBMDA400;Data Source=" & strAS400Name

objCnn.Open strConnect, "WEBUSER01", "XXXXXXX"

'Open index on recordset for control file

strLibrary = Request.QueryString("Library")

strElementType = Request.QueryString("ElementType")

strElementKey = Request.QueryString("ElementKey")

strConnectFile = "/QSYS.LIB/" & strLibrary & ".LIB/CNTLP.FILE(*FIRST,
*NONE)"

objRst.CursorLocation = adUseServer

objRst.Index = strConnectFile

objRst.Open strConnectFile, objCnn, adOpenDynamic, adLockOptimistic,
adCmdTableDirect

'Get row

varKeys = Array(strElementType, strElementKey)

objRst.Seek varKeys, adSeekFirstEQ *********** LINE CAUSING ERROR
******************

=======================================================

Many thanks,

Larry.

2. How to "Easily" create a listing??

3. ADO in VB6 Compared to ADO in AsP

4. Is there a way to avoid inconsistency in identity column's current identity valu

5. Unable to Addnew/Update/movelast by using ADO in ASP

6. OK-TULSA-23312--ORACLE-DBA Skills-RDBMS-Oracle DBA

7. OLAP, ADO, and ASP

8. Subscription to publication 'x' is invalid

9. @@identity, ADO and ASP problem

10. ADO in ASP gobbles connections

11. Unable to AddNew/update by using ADO in ASP

12. FOR XML query problem width ADO on ASP

13. ADO in ASP not returning @@identity value