|
Subject:
|
Please on help recordset can't open
|
|
Posted By:
|
mars1009
|
Post Date:
|
11/12/2004 1:47:25 PM
|
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
|
|
Reply By:
|
mars1009
|
Reply Date:
|
11/12/2004 2:07:26 PM
|
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
|
|
Reply By:
|
happygv
|
Reply Date:
|
11/15/2004 1:43:14 AM
|
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.ExecuteThis is how it should be. Your code around that place seems to be wrong.
Hope that helps. Cheers!
_________________________ - Vijay G Strive for Perfection
|