Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: global.asa


Message #1 by "Ian Richardson" <ian@i...> on Mon, 19 Aug 2002 12:30:35
Hi 
I'm not sure if this is the correct list to post but....
My application requires that a date be placed on hold for an amount of 
time, this is to prevent double booking. If the browser session is 
terminated before the transaction takes place I would like the application 
to update the database to remove all 'on hold' references that have not 
been completed. I had thuoght that I could do this through the global.asa 
but while the code I have uded runs fine in an asp page, the global.asa 
page does not work. Below is the relevant section of my .asa page. Does 
anyonme have any ideas as to why this is not working? Any help will be 
gratefully acknowledged. I have used -
<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common 
Files\system\ado\msado15.dll" --> to include the ado object.

cheers

ian

Sub Session_OnEnd
strPath = "c:\Webserver\db\"
strSuffix = Session("WhichDB") &  ".mdb"
strDBPath = strPath & strSuffix & ";Jet OLEDB:Engine Type=5;"

if session("paid") = False then
	Set con = Server.CreateObject("ADODB.Connection")
	con.Open strDBPath
	Set rst = Server.CreateObject("ADODB.Recordset")
	strSQL = "SELECT * from tblBook where AM = 'am on hold' OR PM 
= 'pm on hold' "
	rst.Open strSQL, con, adOpenStatic, adLockOptimistic
	If Not rst.eof Then
	Do while NOT rst.eof
	rst.update
	rst("AM") = ""
	rst("PM") = ""
   rst.update
	rst.MoveNext
	Loop
	End If
	rst.close
	con.close
end if
Session.Abandon
Application.Unlock()
End Sub
Message #2 by "Vaishnavi" <mail2vaish@y...> on Tue, 20 Aug 2002 06:20:20
If I am not mistaken there is a problem in creating objects in global.asa. 
I am not sure if your problem is due to that. You could just have that 
check in a specific SUB that you can call when the session terminates.
Hope that helps,
Regards,
V


> Hi 
I> 'm not sure if this is the correct list to post but....
M> y application requires that a date be placed on hold for an amount of 
t> ime, this is to prevent double booking. If the browser session is 
t> erminated before the transaction takes place I would like the 
application 
t> o update the database to remove all 'on hold' references that have not 
b> een completed. I had thuoght that I could do this through the 
global.asa 
b> ut while the code I have uded runs fine in an asp page, the global.asa 
p> age does not work. Below is the relevant section of my .asa page. Does 
a> nyonme have any ideas as to why this is not working? Any help will be 
g> ratefully acknowledged. I have used -
<> !-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common 
F> iles\system\ado\msado15.dll" --> to include the ado object.

> cheers

> ian

> Sub Session_OnEnd
s> trPath = "c:\Webserver\db\"
s> trSuffix = Session("WhichDB") &  ".mdb"
s> trDBPath = strPath & strSuffix & ";Jet OLEDB:Engine Type=5;"

> if session("paid") = False then
	> Set con = Server.CreateObject("ADODB.Connection")
	> con.Open strDBPath
	> Set rst = Server.CreateObject("ADODB.Recordset")
	> strSQL = "SELECT * from tblBook where AM = 'am on hold' OR PM 
=>  'pm on hold' "
	> rst.Open strSQL, con, adOpenStatic, adLockOptimistic
	> If Not rst.eof Then
	> Do while NOT rst.eof
	> rst.update
	> rst("AM") = ""
	> rst("PM") = ""
 >   rst.update
	> rst.MoveNext
	> Loop
	> End If
	> rst.close
	> con.close
e> nd if
S> ession.Abandon
A> pplication.Unlock()
E> nd Sub
Message #3 by "Ian Richardson" <ian@i...> on Tue, 20 Aug 2002 07:43:48 +0100
Hi Vaishnavi,
Please forgive me but I'm not sure I understand what you mean. Where do I
put the sub?
In the globa.asa the routine is already in the sub Session On_End.

cheers
ian


----- Original Message -----
From: "Vaishnavi" <mail2vaish@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, August 20, 2002 6:20 AM
Subject: [asp_databases] Re: global.asa


> If I am not mistaken there is a problem in creating objects in global.asa.
> I am not sure if your problem is due to that. You could just have that
> check in a specific SUB that you can call when the session terminates.
> Hope that helps,
> Regards,
> V
>
>
> > Hi
> I> 'm not sure if this is the correct list to post but....
> M> y application requires that a date be placed on hold for an amount of
> t> ime, this is to prevent double booking. If the browser session is
> t> erminated before the transaction takes place I would like the
> application
> t> o update the database to remove all 'on hold' references that have not
> b> een completed. I had thuoght that I could do this through the
> global.asa
> b> ut while the code I have uded runs fine in an asp page, the global.asa
> p> age does not work. Below is the relevant section of my .asa page. Does
> a> nyonme have any ideas as to why this is not working? Any help will be
> g> ratefully acknowledged. I have used -
> <> !-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common
> F> iles\system\ado\msado15.dll" --> to include the ado object.
>
> > cheers
>
> > ian
>
> > Sub Session_OnEnd
> s> trPath = "c:\Webserver\db\"
> s> trSuffix = Session("WhichDB") &  ".mdb"
> s> trDBPath = strPath & strSuffix & ";Jet OLEDB:Engine Type=5;"
>
> > if session("paid") = False then
> > Set con = Server.CreateObject("ADODB.Connection")
> > con.Open strDBPath
> > Set rst = Server.CreateObject("ADODB.Recordset")
> > strSQL = "SELECT * from tblBook where AM = 'am on hold' OR PM
> =>  'pm on hold' "
> > rst.Open strSQL, con, adOpenStatic, adLockOptimistic
> > If Not rst.eof Then
> > Do while NOT rst.eof
> > rst.update
> > rst("AM") = ""
> > rst("PM") = ""
>  >   rst.update
> > rst.MoveNext
> > Loop
> > End If
> > rst.close
> > con.close
> e> nd if
> S> ession.Abandon
> A> pplication.Unlock()
> E> nd Sub
>

Message #4 by "Vaishnavi" <mail2vaish@y...> on Wed, 21 Aug 2002 06:05:34
Hi Ian,

You can have a sub say checksession or something like that in a common asp 
file that you can include in all the files where you want to check the 
session.

Vaishnavi



> Hi Vaishnavi,
Please forgive me but I'm not sure I understand what you mean. Where do I
put the sub?
In the globa.asa the routine is already in the sub Session On_End.

cheers
ian


----- Original Message -----
From: "Vaishnavi" <mail2vaish@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, August 20, 2002 6:20 AM
Subject: [asp_databases] Re: global.asa


> If I am not mistaken there is a problem in creating objects in 
global.asa.
> I am not sure if your problem is due to that. You could just have that
> check in a specific SUB that you can call when the session terminates.
> Hope that helps,
> Regards,
> V
>
>
> > Hi
> I> 'm not sure if this is the correct list to post but....
> M> y application requires that a date be placed on hold for an amount of
> t> ime, this is to prevent double booking. If the browser session is
> t> erminated before the transaction takes place I would like the
> application
> t> o update the database to remove all 'on hold' references that have not
> b> een completed. I had thuoght that I could do this through the
> global.asa
> b> ut while the code I have uded runs fine in an asp page, the global.asa
> p> age does not work. Below is the relevant section of my .asa page. Does
> a> nyonme have any ideas as to why this is not working? Any help will be
> g> ratefully acknowledged. I have used -
> <> !-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common
> F> iles\system\ado\msado15.dll" --> to include the ado object.
>
> > cheers
>
> > ian
>
> > Sub Session_OnEnd
> s> trPath = "c:\Webserver\db\"
> s> trSuffix = Session("WhichDB") &  ".mdb"
> s> trDBPath = strPath & strSuffix & ";Jet OLEDB:Engine Type=5;"
>
> > if session("paid") = False then
> > Set con = Server.CreateObject("ADODB.Connection")
> > con.Open strDBPath
> > Set rst = Server.CreateObject("ADODB.Recordset")
> > strSQL = "SELECT * from tblBook where AM = 'am on hold' OR PM
> =>  'pm on hold' "
> > rst.Open strSQL, con, adOpenStatic, adLockOptimistic
> > If Not rst.eof Then
> > Do while NOT rst.eof
> > rst.update
> > rst("AM") = ""
> > rst("PM") = ""
>  >   rst.update
> > rst.MoveNext
> > Loop
> > End If
> > rst.close
> > con.close
> e> nd if
> S> ession.Abandon
> A> pplication.Unlock()
> E> nd Sub
>


  Return to Index