...

View Full Version : global.asa - error in Session_OnEnd?



Spudhead
04-04-2006, 03:30 PM
from global.asa :


sub Application_OnStart
application("sCn") = "Provider=SQLOLEDB;Data Source=*****;Initial Catalog=*****;UID=*****;PWD=*****"
end sub

sub Application_OnEnd

end sub

sub Session_OnStart

end sub

sub Session_OnEnd
'DELETE UNPURCHASED BASKET'
dim sSQL1 : sSQL1 = "DELETE FROM [tblBasket] WHERE [order_id] IN(SELECT [id] FROM [tblOrders] where [tblOrders].[user_id] = "& session("userID") &" and [tblOrders].[order_status] = '1')"
dim sSQL2 : sSQL2 = "DELETE FROM [tblOrders] where [user_id] = "& session("userID") &" and [order_status] = '1'"
dim oCn
set oCn = Server.CreateObject("ADODB.Connection")
oCn.open application("sCn")
oCn.execute sSQL1
oCn.execute sSQL2
oCn.close
set oCn = nothing
end sub


I know that the database connection string is being dropped correctly into the application variable, so Application_OnStart is being called ok.

I was operating under the assumption that, even if a user simply closed their browser window without "properly" ending the session, the code in Session_OnEnd would still run. It looks like I was wrong.

Can anyone confirm/deny?

nikkiH
04-04-2006, 05:37 PM
It does.
There are other issues though.

http://www.aspfaq.com/show.asp?id=2078

Spudhead
04-05-2006, 10:45 AM
Ah. Nuts.

thanks :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum