Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 19th, 2006, 02:26 PM
Friend of Wrox
Points: 422, Level: 7
Points: 422, Level: 7 Points: 422, Level: 7 Points: 422, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: La Jolla, CA, USA.
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reference ADO Recordset Field after CommitTrans

I seem to getting an error when referencing a field within a recordset after performing a CommitTrans. Following ASP code snippet illustrates this:

Code:
With RS
    DB.BeginTrans

    'Do some database operations here

    If Not ErrorStatus Then
        DB.RollbackTrans
        Exit Function
    End If

    'Do some more db operations here

    DB.CommitTrans

    ' Update field.
    .Fields("myField") = 1                        ' <- Error here
End With
I'm wondering if there are any guidelines on accessing/updating a recordset after a CommitTrans? Also, this same code works in ACCESS VBA module.
  #2 (permalink)  
Old November 20th, 2006, 12:06 PM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What error are you getting?

Woody Z http://www.learntoprogramnow.com
  #3 (permalink)  
Old November 20th, 2006, 05:03 PM
Friend of Wrox
Points: 422, Level: 7
Points: 422, Level: 7 Points: 422, Level: 7 Points: 422, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: La Jolla, CA, USA.
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ASP Error:

Quote:
quote:error '80020009'
Exception occurred.
I'm wondering if there is a problem with the cursor?

Code snippet that opens recordset:

Code:
    Set db = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    db.Open Application("Database_ConnectionString")
    rs.Open SQL, db, adOpenKeyset, adLockOptimistic, adCmdText
  #4 (permalink)  
Old November 20th, 2006, 06:43 PM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The first this is to verify that you have a record.
Make sure the recordset isn't EOF (or BOF) at the time you are trying to access that field.


Woody Z http://www.learntoprogramnow.com
  #5 (permalink)  
Old November 20th, 2006, 07:29 PM
Friend of Wrox
Points: 422, Level: 7
Points: 422, Level: 7 Points: 422, Level: 7 Points: 422, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: La Jolla, CA, USA.
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Let's assume the code works fine... which it does in an Access Project file. I'm simply trying to port the code to ASP.


  #6 (permalink)  
Old November 21st, 2006, 03:20 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by U.N.C.L.E.
 Let's assume the code works fine... which it does in an Access Project file. I'm simply trying to port the code to ASP.

First of all, the code might work fine, but if there is no data in the table, it will error with the error you are giving.

Assuming that is true (and your code really should check this), what are the field datatypes in your query that creates the recordset. Access will behave differently than ASP with memo fields. Are there any memo fields?


Woody Z http://www.learntoprogramnow.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone DAO Recordset into ADO Recordset kamrans74 VB How-To 0 March 6th, 2007 11:57 AM
ADO Recordset Scootterp Access VBA 4 February 27th, 2006 06:44 PM
Convert ADO recordset to DAO recordset andrew_taft Access 1 May 5th, 2004 02:31 PM
Changing ADO Recordset Field Type Niaz Pro VB Databases 0 January 18th, 2004 02:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.