Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: HELP! this one is getting me really MAD!


Message #1 by "Eric Van Camp" <eric@a...> on Fri, 16 Feb 2001 12:55:59 -0000
This is a multi-part message in MIME format.



------=_NextPart_000_006B_01C09817.CF46B040

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: 7bit



Hi all,

executing this file on the server gives me always the message :

delete from lheads where lheadsid=7

ADODB.Recordset error '800a0e78'



The operation requested by the application is not allowed if the object is

closed.



*******



can anyone give me a clue??I can not figure out why the recordset object is

closed cos i think it isn't!!



****code****



<%@ LANGUAGE = VBSCRIPT %>

<%response.buffer=true%>

<!--#include VIRTUAL="INCLUDES/tools_ameel.inc"-->

<!-- #include virtual="includes/adovbs.inc" -->

<!--#include virtual="includes/sysadmin.inc"-->

<!-- #include virtual="includes/path.inc" -->

<!-- #include virtual="includes/gensessionid2.inc" -->





</head>

<body text="#FFFFFF" link="#0000A0" vlink="#0000A0" alink="#0000A0"

bgcolor="#FFFFFF">

<%

lheadsid=request.querystring("Lheadsid")

'--- Instanciate SA-FileUp

Set upl = Server.CreateObject("SoftArtisans.FileUp")



rem create a sso to provide link to the database

set conn = Server.CreateObject("ADODB.Connection")



rem set connect info

conn.Connectionstring = "DSN=" & application("OdbcConname") & ";UID=" &

application("OdbcUsername") & ";PWD=" & application("OdbcPassword")



rem open the connection

conn.open



rem make ADO recordset

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



rem  *** check whether update or delete

action= upl.form("update.x")

if action <> ""  then

 action ="UPDATE"

else

 action="DELETE"

end if

if action="update" then







 rem remember filename

 rem value inserted here



 if upl.form("newimage")="no" then

  filename1= upl.form("old_banner1")

 else

  filename1= filefromurl(upl.form("banner1").UserFilename)

  filename1=replace(gensessionid+filename1," ","")

 end if



 temp4=filename1

 temp3 = replace(filename1," ","")

 file1 = application("UIFS") &"lheads"&"\"& filename1



 rem ***instanciate filescripting object

 rem*** to find out whether exists

 set objfiles = createobject("Scripting.fileSystemObject")



 if objfiles.FileExists(file1) then%>

  <br><br><br><br><br>

   <center>

   <font face="Arial, Helvetica" size="3" color="0000A0">

   <strong>

  <%response.write "The name " & temp4 & " is already used... Please rename

your file and try again."



  %>

   </strong>

   </font>

   </center>

   <br><br><br>

   <center>

   <font face="Arial, Helvetica" size="2">

   <a href="" onClick="history.go(-1);return 1">Click here</a>

 <%else

  rem*********checking and saving to server of filename1

   if len(temp3) <> 0 then

    'response.write"temp3<>0"



      rem save files to server disk

   if IsObject(upl.form("banner1")) Then

    if trim(filename1) <> "" then

     'response.write "Saving to location: " & application("UIFS") & "lheads"

& "\"& filename1 &"<BR>"



     rem set save path

     upl.Path = application("UIFS")



     rem save file on the server

     upl.Form("banner1").SaveAs application("UIFS") & "lheads" & "\" &

filename1

     'response.write "saved to server"



     rem clear filename1

     filename1 = ""

    end if

   end if

   end if

 end if





' addressid=upl.form("addressid")

 strtel=upl.form("tel")

 strfax=upl.form("fax")

 strbtw=upl.form("btw")

 strhr=upl.form("hr")

 strb1=upl.form("b1")

 'response.write "strb1="&strb1

 strb2=upl.form("b2")

 strb3=upl.form("b3")

 strb4=upl.form("b4")

 stremail=upl.form("email")

 temp1 = upl.form("qsi")

 'response.write"temp1="&temp1&"<br>"

 'response.write"typeid="&upl.form("typeid")

 rem Create a command

 ' HERE YOU CAN HAVE ERROR HANDLER

 'ON ERROR RESUME NEXT



 set adoCommand = Server.CreateObject("ADODB.Command")

 adoCommand.CommandType = adCmdText

 adoCommand.ActiveConnection = conn



 rem Constuct your sql query

 if temp1 = "Yes" then

  'response.write"temp1=yes"

  stractif = -1

 else

  stractif = 0

 end if



 temp4=upl.form("telbox")

 if temp4<>"on" then strtel=""

 response.write "strtel="&strtel

 temp5=upl.form("faxbox")

 if temp5<>"on" then strfax=""

 response.write "strfax="&strfax

 temp6=upl.form("btwbox")

 if temp6<>"on" then strbtw=""

 'response.write "btwbox="&temp6

 temp7=upl.form("hrbox")

 if temp7<>"on" then strhr=""

 'response.write temp7

 temp8=upl.form("b1box")

 if temp8<>"on" then strb1=""

 'response.write temp8

 temp9=upl.form("b2box")

 if temp9<>"on" then strb2=""

 temp12=upl.form("b3box")

 if temp12 <>"on" then strb3=""

 'response.write temp9

 temp10=upl.form("b4box")

 if temp10<>"on" then strb4=""

 'response.write temp10

 temp11=upl.form("emailbox")

 if temp11 <>"on" then stremail=""

 'response.write stremail

 'response.write temp11

 'response.write "request.formcoyid="&upl.form("coyid")

 'response.write "typeid="&upl.form'"typeid"

 strSQL="UPDATE lheads"&_

 " Set lheads.coyid='"& upl.form("coyId") & "',lheads.banner1='"&temp3&"',

lheads.addressid="& upl.form("addressid") & ", lheads.tel='" & strtel & "',

lheads.fax='" & strfax & "', lheads.btw='"& strbtw &"', lheads.hr='"& strhr

& "' ,lheads.b1= '"& strb1 &"',lheads.b2='"& strb2 &"' ,lheads.b3= '"& strb3

&"',lheads.b4='"& strb4 &"' ,lheads.descr_eng='"&

upl.form("descr_eng")&"',lheads.descr_nl='"&upl.form("descr_nl")&"',lheads.p

aper='"& upl.form("paper")&"' ,lheads.printcolors='"&

upl.form("printcolors")&"'

,lheads.actif="&stractif&",lheads.email='"&stremail&"' where

lheads.lheadsid="&lheadsid&""

 response.write strsql

 adoCommand.CommandText = strSQL

 adoCommand.Execute



 'RELEASE RESSOURCES



 response.redirect "index.asp?sessionid="&sessionid





else



 SQLupdate="delete from lheads where lheadsid="&lheadsid

 response.write sqlupdate

 rs.open sqlupdate,conn,adLockOptimistic,adOpenDynamic,adCmdText



end if



conn.close

set adoCommand = nothing

set conn = nothing

rs.close

set rs=nothing

response.redirect ("index.asp?sessionid="&sessionid&"")

%>





*********end code******



thanks



Eric Van Camp


















Message #2 by "Ken Schaefer" <ken@a...> on Sat, 17 Feb 2001 00:23:39 +1100
I don't know how you manage to write pages like this and understand what

they do!

(you need to encapsulate stuff into functions).



But you do this:



 SQLupdate="delete from lheads where lheadsid="&lheadsid

 response.write sqlupdate

 rs.open sqlupdate,conn,adLockOptimistic,adOpenDynamic,adCmdText



A DELETE FROM SQL statement does not return a recordset, instead you should

do:



conn.execute(sqlupdate,,adExecuteNoRecords)



Also, you have;



conn.close

set adoCommand = nothing

set conn = nothing

rs.close

set rs=nothing



If you close conn, you also implicitly close all other objects...

Now - set you can't set adoCommand = nothing, because you didn't create it,

except in the If...then statement that redirects...

Further, since rs depends on conn you should do something like:



rs.close

Set rs = nothing

conn.close

Set conn = nothing



HTH



Cheers

Ken





----- Original Message -----

From: "Eric Van Camp" <eric@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Saturday, February 17, 2001 8:09 AM

Subject: [asp_databases] HELP! this one is getting me really MAD!





> This is a multi-part message in MIME format.

>

> ------=_NextPart_000_006B_01C09817.CF46B040

> Content-Type: text/plain;

> charset="iso-8859-1"

> Content-Transfer-Encoding: 7bit

>

> Hi all,

> executing this file on the server gives me always the message :

> delete from lheads where lheadsid=7

> ADODB.Recordset error '800a0e78'

>

> The operation requested by the application is not allowed if the object is

> closed.

>

> *******

>

> can anyone give me a clue??I can not figure out why the recordset object

is

> closed cos i think it isn't!!

>

> ****code****

>

> <%@ LANGUAGE = VBSCRIPT %>

> <%response.buffer=true%>

> <!--#include VIRTUAL="INCLUDES/tools_ameel.inc"-->

> <!-- #include virtual="includes/adovbs.inc" -->

> <!--#include virtual="includes/sysadmin.inc"-->

> <!-- #include virtual="includes/path.inc" -->

> <!-- #include virtual="includes/gensessionid2.inc" -->



<stuff snipped>



Message #3 by thomas@i... on Fri, 16 Feb 2001 14:11:22 +0100
it is in fact closed



where you're writing conn.open you're not saying what to open. try writing 



conn.open Connectionstring or something like that





















This is a multi-part message in MIME format.



------=_NextPart_000_006B_01C09817.CF46B040

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: 7bit



Hi all,

executing this file on the server gives me always the message :

delete from lheads where lheadsid=7

ADODB.Recordset error '800a0e78'



The operation requested by the application is not allowed if the object is

closed.



*******



can anyone give me a clue??I can not figure out why the recordset object is

closed cos i think it isn't!!



****code****



<%@ LANGUAGE = VBSCRIPT %>

<%response.buffer=true%>

<!--#include VIRTUAL="INCLUDES/tools_ameel.inc"-->

<!-- #include virtual="includes/adovbs.inc" -->

<!--#include virtual="includes/sysadmin.inc"-->

<!-- #include virtual="includes/path.inc" -->

<!-- #include virtual="includes/gensessionid2.inc" -->





Message #4 by "Eric Van Camp" <eric@a...> on Fri, 16 Feb 2001 15:14:14 -0000
hi,

did what you suggested,

replaced by conn.execute(sqlupdate, , adExecuteNoRecords)

but get the next error message:!

*******

Microsoft VBScript compilation error '800a0414'



Cannot use parens when calling a Sub



?



conn.execute(sqlupdate,,adExecuteNoRecords)

-------------------------------------------^

***************

what does this mean??

txs





-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Friday, February 16, 2001 1:24 PM

To: ASP Databases

Subject: [asp_databases] Re: HELP! this one is getting me really MAD!





I don't know how you manage to write pages like this and understand what

they do!

(you need to encapsulate stuff into functions).



But you do this:



 SQLupdate="delete from lheads where lheadsid="&lheadsid

 response.write sqlupdate

 rs.open sqlupdate,conn,adLockOptimistic,adOpenDynamic,adCmdText



A DELETE FROM SQL statement does not return a recordset, instead you should

do:



conn.execute(sqlupdate,,adExecuteNoRecords)



Also, you have;



conn.close

set adoCommand = nothing

set conn = nothing

rs.close

set rs=nothing



If you close conn, you also implicitly close all other objects...

Now - set you can't set adoCommand = nothing, because you didn't create it,

except in the If...then statement that redirects...

Further, since rs depends on conn you should do something like:



rs.close

Set rs = nothing

conn.close

Set conn = nothing



HTH



Cheers

Ken





----- Original Message -----

From: "Eric Van Camp" <eric@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Saturday, February 17, 2001 8:09 AM

Subject: [asp_databases] HELP! this one is getting me really MAD!





> This is a multi-part message in MIME format.

>

> ------=_NextPart_000_006B_01C09817.CF46B040

> Content-Type: text/plain;

> charset="iso-8859-1"

> Content-Transfer-Encoding: 7bit

>

> Hi all,

> executing this file on the server gives me always the message :

> delete from lheads where lheadsid=7

> ADODB.Recordset error '800a0e78'

>

> The operation requested by the application is not allowed if the object is

> closed.

>

> *******

>

> can anyone give me a clue??I can not figure out why the recordset object

is

> closed cos i think it isn't!!

>

> ****code****

>

> <%@ LANGUAGE = VBSCRIPT %>

> <%response.buffer=true%>

> <!--#include VIRTUAL="INCLUDES/tools_ameel.inc"-->

> <!-- #include virtual="includes/adovbs.inc" -->

> <!--#include virtual="includes/sysadmin.inc"-->

> <!-- #include virtual="includes/path.inc" -->

> <!-- #include virtual="includes/gensessionid2.inc" -->



<stuff snipped>



Message #5 by Imar Spaanjaars <Imar@S...> on Fri, 16 Feb 2001 15:54:16 +0100
Basically, it means that you cannot use paren(these)s when you are calling 

a sub ;-)



Drop the parentheses (()) and it'll work



conn.execute sqlupdate, , adExecuteNoRecords



should do the trick.



VB and VBScript are quite picky on when you are allowed to use parens. 

There are some rules when to use them and when not, but they are not always 

clear.



Imar





At 03:14 PM 2/16/2001 +0000, you wrote:

>hi,

>did what you suggested,

>replaced by conn.execute(sqlupdate, , adExecuteNoRecords)

>but get the next error message:!

>*******

>Microsoft VBScript compilation error '800a0414'

>

>Cannot use parens when calling a Sub

>

>?

>

>conn.execute(sqlupdate,,adExecuteNoRecords)

>-------------------------------------------^

>***************

>what does this mean??

>txs



Message #6 by "Wally Burfine" <oopconsultant@h...> on Fri, 16 Feb 2001 15:55:20 -0000
That means that you are calling a function and not setting the return value 

to a variable. If you call a function with the intent of throwing away the 

return use the CALL syntax.



Regards,

Wally





>From: "Eric Van Camp" <eric@a...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: HELP! this one is getting me really MAD!

>Date: Fri, 16 Feb 2001 15:14:14 -0000

>

>hi,

>did what you suggested,

>replaced by conn.execute(sqlupdate, , adExecuteNoRecords)

>but get the next error message:!

>*******

>Microsoft VBScript compilation error '800a0414'

>

>Cannot use parens when calling a Sub

>

>?

>

>conn.execute(sqlupdate,,adExecuteNoRecords)

>-------------------------------------------^

>***************

>what does this mean??

>txs

>

>

>-----Original Message-----

>From: Ken Schaefer [mailto:ken@a...]

>Sent: Friday, February 16, 2001 1:24 PM

>To: ASP Databases

>Subject: [asp_databases] Re: HELP! this one is getting me really MAD!

>

>

>I don't know how you manage to write pages like this and understand what

>they do!

>(you need to encapsulate stuff into functions).

>

>But you do this:

>

>  SQLupdate="delete from lheads where lheadsid="&lheadsid

>  response.write sqlupdate

>  rs.open sqlupdate,conn,adLockOptimistic,adOpenDynamic,adCmdText

>

>A DELETE FROM SQL statement does not return a recordset, instead you should

>do:

>

>conn.execute(sqlupdate,,adExecuteNoRecords)

>

>Also, you have;

>

>conn.close

>set adoCommand = nothing

>set conn = nothing

>rs.close

>set rs=nothing

>

>If you close conn, you also implicitly close all other objects...

>Now - set you can't set adoCommand = nothing, because you didn't create it,

>except in the If...then statement that redirects...

>Further, since rs depends on conn you should do something like:

>

>rs.close

>Set rs = nothing

>conn.close

>Set conn = nothing

>

>HTH

>

>Cheers

>Ken

>

>

>----- Original Message -----

>From: "Eric Van Camp" <eric@a...>

>To: "ASP Databases" <asp_databases@p...>

>Sent: Saturday, February 17, 2001 8:09 AM

>Subject: [asp_databases] HELP! this one is getting me really MAD!

>

>

> > This is a multi-part message in MIME format.

> >

> > ------=_NextPart_000_006B_01C09817.CF46B040

> > Content-Type: text/plain;

> > charset="iso-8859-1"

> > Content-Transfer-Encoding: 7bit

> >

> > Hi all,

> > executing this file on the server gives me always the message :

> > delete from lheads where lheadsid=7

> > ADODB.Recordset error '800a0e78'

> >

> > The operation requested by the application is not allowed if the object 

>is

> > closed.

> >

> > *******

> >

> > can anyone give me a clue??I can not figure out why the recordset object

>is

> > closed cos i think it isn't!!

> >

> > ****code****

> >

> > <%@ LANGUAGE = VBSCRIPT %>

> > <%response.buffer=true%>

> > <!--#include VIRTUAL="INCLUDES/tools_ameel.inc"-->

> > <!-- #include virtual="includes/adovbs.inc" -->

> > <!--#include virtual="includes/sysadmin.inc"-->

> > <!-- #include virtual="includes/path.inc" -->

> > <!-- #include virtual="includes/gensessionid2.inc" -->

>

><stuff snipped>

>

>
Message #7 by "Bhanu Shanker" <bhanu271978@y...> on Wed, 21 Feb 2001 07:51:49
Hi , 

try putting rs.Open after instantiating the RecordSet object 





BHANU


  Return to Index