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 November 12th, 2004, 02:47 PM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please on help recordset can't open

I am begnnier of writing ASP and have following error.
The error message is
"Operation is not allowed when the object is closed."

I guess the record is not yet opened, Could anyone tell me how can I open it?
Sorry for bad English, from HK...
Thank you in advance.

I attach my code as follow:
Dim objRS, objcomm, objparam, strdirector

set objcomm = server.CreateObject ("ADODB.Command")

objcomm.ActiveConnection = strconnect

objcomm.CommandText ="getuserinfo"
objcomm.CommandType = adcmdstoredproc
set objparam = objcomm.CreateParameter ("@pcstyl",adChar,adparaminput,50)

objcomm.Parameters.append objparam

strdirector ="peter"
objcomm.Parameters ("@user") = strdirector

set objrs = objcomm.Execute

set objcomm =nothing
set objparam = nothing

while not objrs.eof
Response.Write objrs ("user") & objrs ("address")
objrs.movenext
wend

objrs.close
set objrs=nothing
 
Old November 12th, 2004, 03:07 PM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I attach the new code as follow. Thank you.

Dim objRS, objcomm, objparam, strdirector

set objcomm = server.CreateObject ("ADODB.Command")

objcomm.ActiveConnection = strconnect

objcomm.CommandText ="getuserinfo"
objcomm.CommandType = adcmdstoredproc
set objparam = objcomm.CreateParameter ("@user",adChar,adparaminput,50)

objcomm.Parameters.append objparam

strdirector ="peter"
objcomm.Parameters ("@user") = strdirector

set objrs = objcomm.Execute

set objcomm =nothing
set objparam = nothing

while not objrs.eof
Response.Write objrs ("user") & objrs ("address")
objrs.movenext
wend

objrs.close
set objrs=nothing


 
Old November 15th, 2004, 02:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Code:
objcomm.CommandText ="getuserinfo"
objcomm.CommandType = adcmdstoredproc
set objparam = objcomm.CreateParameter ("@user",adChar,adparaminput,50)
strdirector ="peter"
objparam = strdirector
objcomm.Parameters.append objparam
set objrs = objcomm.Execute
This is how it should be. Your code around that place seems to be wrong.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Open document, Open second doc and copy to first justabeginner Word VBA 1 March 7th, 2007 02:47 AM
Clone DAO Recordset into ADO Recordset kamrans74 VB How-To 0 March 6th, 2007 11:57 AM
recordset open error MMJiggy62 Beginning VB 6 2 September 4th, 2006 04:52 PM
ADODB.Recordset (0x800A0CB3)Current Recordset does tks_muthu Classic ASP Databases 0 June 16th, 2005 07:22 AM
Convert ADO recordset to DAO recordset andrew_taft Access 1 May 5th, 2004 02:31 PM





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