Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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
 
Old July 5th, 2003, 02:16 AM
Registered User
 
Join Date: Jul 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with obJRecSet.close

I am using the following in my ASP:

strsql ="update biodata set father_name='"&fname&"',email_add='"&email&"' where rollno='"& rollno &"'"

set objRecSet = Server.CreateObject("ADODB.Recordset")

objRecSet.Open strsql, objConn, adopenKeySet, adLockOptimistic

objRecSet.Close

ASP is returning an error at ObjRecSet.Close. Though it is updating the database. The error is Record SET already closed. What is the error? IF i omit the close statement it works fine. Can any one explain?

Hemalatha
 
Old July 5th, 2003, 07:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Hemalatha,

If the command you performed in the strsql statement has'nt some returned rows or the values,the closed recordset has returned.
However, in order to prevent an error's occurrence you can check a recordset state before u call Close() method.
Code:
If objRecSet.State <> adStateClosed Then objRecSet.Close
Regards,

...but the Soon is eclipsed by the Moon
 
Old July 5th, 2003, 08:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In addition to what NotNowJohn has said, there is another way to execute Update queries that will perform a bit quicker.

You don't have to create a Recordset for Insert, Update and Delete queries, because there won't be any records return to the client. You can simply use the Execute method of the Connection object to this:

Code:
objConn.Open
objConn.Execute(strsql)
objConn.Close
This saves you from creating a recordset that is never used.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 7th, 2003, 07:07 AM
Registered User
 
Join Date: Jul 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks both of u.

Hemalatha

Hemalatha





Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close when screen saver close Rehanrana Pro VB 6 1 April 7th, 2008 03:09 AM
window.close() failing to...well...close! mheathcote Javascript How-To 2 October 31st, 2005 03:02 PM
Underlying connection close problem - HTTP Send vivjohar Biztalk 0 August 22nd, 2005 11:47 AM
HELP!! So close..CH 16 - problem updating BookNews seeDerekNow JSP Basics 0 August 25th, 2004 12:48 AM
How do i close pop-up window?: window.close () Burton HTML Code Clinic 2 September 8th, 2003 05:40 AM





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