472,988 Members | 2,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 software developers and data experts.

code doesn't work in global.asa

Hi

I have code in my login.asp which sets the online field in user database to
true or 1. I am trying to use the same code in global.asa to change back the
online field to 0 but it doesn't work. The code is very simple and it should
work, any idea why it doesn't?

Sub Session_OnEnd
If Session("User_ID")<>" " Then ' check if user has logged in
before.
ConnectionString = "Driver={SQL
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111.111
..111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_ID") & ")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF
Jul 19 '05 #1
11 2151
hard code the UserID once and try, to see if the Session() is what's failing

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Julian" <ep****@shaw.ca> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi

I have code in my login.asp which sets the online field in user database to true or 1. I am trying to use the same code in global.asa to change back the online field to 0 but it doesn't work. The code is very simple and it should work, any idea why it doesn't?

Sub Session_OnEnd
If Session("User_ID")<>" " Then ' check if user has logged in
before.
ConnectionString = "Driver={SQL
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111.111 .111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_ID") & ")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF

Jul 19 '05 #2
How do you know it's not working? Are you calling Session.Abandon to see if
it works? Try this code:

Sub Session_OnEnd()
CreateObject("WScript.Shell").Run "cmd.exe /c net send
YOUR_COMPUTER_NAME I'm running", 0, False
UserID = Session("User_ID")
If UserID <> "" Then
ConnectionString = "Driver={SQL Server};UID=" & _
"emenworldcom2;Password=BBBBBB;" & _
"DATABASE=Mydatabase;SERVER=111.111.111.11\i1"
'''Get an oledb connection string at
'''www.connectionstrings.com instead
'''of using this ODBC one.
SQL = "UPDATE [Users] SET [Online]=0 WHERE [UserID]=" & UserID
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Conn2Gallery.Open ConnectionString
Conn2Gallery.Execute SQL, ,129
Conn2Gallery.Close : Set Conn2Gallery = Nothing
End If

End Sub
Ray at home
"Julian" <ep****@shaw.ca> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi

I have code in my login.asp which sets the online field in user database to true or 1. I am trying to use the same code in global.asa to change back the online field to 0 but it doesn't work. The code is very simple and it should work, any idea why it doesn't?

Sub Session_OnEnd
If Session("User_ID")<>" " Then ' check if user has logged in
before.
ConnectionString = "Driver={SQL
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111.111 .111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_ID") & ")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF

Jul 19 '05 #3
I had the same problem.
Check and see if the folder give access to the IIS Process Account
(IWAM_yourmachinename) to write into the db.

Paolo
"Julian" <ep****@shaw.ca> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi

I have code in my login.asp which sets the online field in user database to true or 1. I am trying to use the same code in global.asa to change back the online field to 0 but it doesn't work. The code is very simple and it should work, any idea why it doesn't?

Sub Session_OnEnd
If Session("User_ID")<>" " Then ' check if user has logged in before.
ConnectionString = "Driver={SQL
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111
..111 .111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_ID") & ")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF

Jul 19 '05 #4
Hi

Thanks for the answers but I am still stucked. I am on shared hosting and
the folder has permission to write to database since my other programs in
this folder do it. I have hard coded the user_id to 1 (record 1) and then
logged in and logged off (session abond), checked the field online and it is
still set to 1. Changed the code according to ray

UserId=Sesssion ("User_Id")
If UserId<>"" Then
and also used variable UserId in select statement
logged , checked the session ("User_Id) and it was 1 & logged off, all
session variable were gone, checked the database, the online field was still
1.
"PiGei" <ja***************@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I had the same problem.
Check and see if the folder give access to the IIS Process Account
(IWAM_yourmachinename) to write into the db.

Paolo
"Julian" <ep****@shaw.ca> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi

I have code in my login.asp which sets the online field in user

database to
true or 1. I am trying to use the same code in global.asa to change

back the
online field to 0 but it doesn't work. The code is very simple and it

should
work, any idea why it doesn't?

Sub Session_OnEnd
If Session("User_ID")<>" " Then ' check if user has logged

in
before.
ConnectionString = "Driver={SQL

Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111
.111
.111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_ID") & ")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF


Jul 19 '05 #5
Do you have session_onstart code in this same global.asa file, and if so,
does that work okay? Why I'm asking is that I'm wondering if your
global.asa file is in the correct directory for how applications are defined
in IIS for your site.

Ray at home

"Julian" <ep****@shaw.ca> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
Hi

Thanks for the answers but I am still stucked. I am on shared hosting and
the folder has permission to write to database since my other programs in
this folder do it. I have hard coded the user_id to 1 (record 1) and then
logged in and logged off (session abond), checked the field online and it is still set to 1. Changed the code according to ray

UserId=Sesssion ("User_Id")
If UserId<>"" Then
and also used variable UserId in select statement
logged , checked the session ("User_Id) and it was 1 & logged off, all
session variable were gone, checked the database, the online field was still 1.
"PiGei" <ja***************@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I had the same problem.
Check and see if the folder give access to the IIS Process Account
(IWAM_yourmachinename) to write into the db.

Paolo
"Julian" <ep****@shaw.ca> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi

I have code in my login.asp which sets the online field in user

database to
true or 1. I am trying to use the same code in global.asa to change

back the
online field to 0 but it doesn't work. The code is very simple and it

should
work, any idea why it doesn't?

Sub Session_OnEnd
If Session("User_ID")<>" " Then ' check if user has logged

in
before.
ConnectionString = "Driver={SQL

Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111
.111
.111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_ID") & ")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF



Jul 19 '05 #6
Hi

I have both session_onstart and application_onstart which declares a
variable for number of user and those work, even on session_onend, I minus
the variable with 1 and it works too.

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
Do you have session_onstart code in this same global.asa file, and if so,
does that work okay? Why I'm asking is that I'm wondering if your
global.asa file is in the correct directory for how applications are defined in IIS for your site.

Ray at home

"Julian" <ep****@shaw.ca> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
Hi

Thanks for the answers but I am still stucked. I am on shared hosting and the folder has permission to write to database since my other programs in this folder do it. I have hard coded the user_id to 1 (record 1) and then logged in and logged off (session abond), checked the field online and
it is
still set to 1. Changed the code according to ray

UserId=Sesssion ("User_Id")
If UserId<>"" Then
and also used variable UserId in select statement
logged , checked the session ("User_Id) and it was 1 & logged off, all
session variable were gone, checked the database, the online field was

still
1.
"PiGei" <ja***************@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I had the same problem.
Check and see if the folder give access to the IIS Process Account
(IWAM_yourmachinename) to write into the db.

Paolo
"Julian" <ep****@shaw.ca> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
> Hi
>
> I have code in my login.asp which sets the online field in user
database to
> true or 1. I am trying to use the same code in global.asa to change
back the
> online field to 0 but it doesn't work. The code is very simple and it should
> work, any idea why it doesn't?
>
> Sub Session_OnEnd
> If Session("User_ID")<>" " Then ' check if user has logged in
> before.
> ConnectionString = "Driver={SQL
>
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111 .111
> .111.11\i1"
> Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
> Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
> Conn2Gallery.Open ConnectionString
> SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
> Session("User_ID") & ")"
> SQL.CommandType = 1
> Set SQL.ActiveConnection = Conn2Gallery
> CmdTrackUser.Open SQL, , 1, 3
> CmdTrackUser.Fields("Online") = 0
> CmdTrackUser.Update
> CmdTrackUser.Close
> Set CmdTrackUser = Nothing
> Conn2Gallery.Close
> Set Conn2Gallery = Nothing
> END IF
>
>



Jul 19 '05 #7
Please post the contents of your global.asa. Maybe we'll see something that
could be causing thing.

Ray at hoem

"Julian" <ep****@shaw.ca> wrote in message
news:eG**************@TK2MSFTNGP12.phx.gbl...
Hi

I have both session_onstart and application_onstart which declares a
variable for number of user and those work, even on session_onend, I minus
the variable with 1 and it works too.

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
Do you have session_onstart code in this same global.asa file, and if so,
does that work okay? Why I'm asking is that I'm wondering if your
global.asa file is in the correct directory for how applications are

defined
in IIS for your site.

Ray at home

"Julian" <ep****@shaw.ca> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
Hi

Thanks for the answers but I am still stucked. I am on shared hosting

and the folder has permission to write to database since my other programs in this folder do it. I have hard coded the user_id to 1 (record 1) and then logged in and logged off (session abond), checked the field online and it
is
still set to 1. Changed the code according to ray

UserId=Sesssion ("User_Id")
If UserId<>"" Then
and also used variable UserId in select statement
logged , checked the session ("User_Id) and it was 1 & logged off, all
session variable were gone, checked the database, the online field was

still
1.
"PiGei" <ja***************@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
> I had the same problem.
> Check and see if the folder give access to the IIS Process Account
> (IWAM_yourmachinename) to write into the db.
>
> Paolo
>
>
> "Julian" <ep****@shaw.ca> wrote in message
> news:%2***************@tk2msftngp13.phx.gbl...
> > Hi
> >
> > I have code in my login.asp which sets the online field in user
> database to
> > true or 1. I am trying to use the same code in global.asa to change > back the
> > online field to 0 but it doesn't work. The code is very simple and

it > should
> > work, any idea why it doesn't?
> >
> > Sub Session_OnEnd
> > If Session("User_ID")<>" " Then ' check if user has logged > in
> > before.
> > ConnectionString = "Driver={SQL
> >
> Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111 > .111
> > .111.11\i1"
> > Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
> > Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
> > Conn2Gallery.Open ConnectionString
> > SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
> > Session("User_ID") & ")"
> > SQL.CommandType = 1
> > Set SQL.ActiveConnection = Conn2Gallery
> > CmdTrackUser.Open SQL, , 1, 3
> > CmdTrackUser.Fields("Online") = 0
> > CmdTrackUser.Update
> > CmdTrackUser.Close
> > Set CmdTrackUser = Nothing
> > Conn2Gallery.Close
> > Set Conn2Gallery = Nothing
> > END IF
> >
> >
>
>



Jul 19 '05 #8
Here is the global.asa:

<!--#include file=chat/chatapi.asp-->
<script language=vbscript runat=server>
Sub Session_OnStart
Session.Timeout=15 'minutes
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers")+1
Application.Unlock

End Sub

Sub Session_OnEnd
UserID = Session("User_ID")
If UserID <>"" Then
ConnectionString = "Driver={SQL
Server};UID=MEME;Password=BBBBBB;DATABASE=Mydataba se;SERVER=111.111.111.11\i
1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID =" & UserID &
")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF
call LogOffUser(ChatSessionUidGet(),false)

Application.Lock
Application("ActiveUsers") = Application("ActiveUsers")-1
Application.Unlock
End Sub

Sub Application_OnStart
application("siteDate") = date()
Application("shs1sql_ConnectionString") = "Driver={SQL
Server};UID=MEME;Password=BBBBBB;DATABASE=Mydataba se;SERVER=111.111.111.11\i
1"
Application("shs1sql_ConnectionTimeout") = 15
Application("shs1sql_CommandTimeout") = 30
Application("shs1sql_CursorLocation") = 3
Application("shs1sql_RuntimeUserName") = "MEME"
Application("shs1sql_RuntimePassword") = "BBBBBB"

Application.Lock
Application("ActiveUsers")=0
Application.Unlock

End Sub

Sub Application_OnEnd
'not used for chat, but can be used for other things on your site
End Sub

</script>

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:ue**************@tk2msftngp13.phx.gbl...
Please post the contents of your global.asa. Maybe we'll see something that could be causing thing.

Ray at hoem

"Julian" <ep****@shaw.ca> wrote in message
news:eG**************@TK2MSFTNGP12.phx.gbl...
Hi

I have both session_onstart and application_onstart which declares a
variable for number of user and those work, even on session_onend, I minus
the variable with 1 and it works too.

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
Do you have session_onstart code in this same global.asa file, and if so, does that work okay? Why I'm asking is that I'm wondering if your
global.asa file is in the correct directory for how applications are

defined
in IIS for your site.

Ray at home

"Julian" <ep****@shaw.ca> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
> Hi
>
> Thanks for the answers but I am still stucked. I am on shared hosting and
> the folder has permission to write to database since my other
programs
in
> this folder do it. I have hard coded the user_id to 1 (record 1) and

then
> logged in and logged off (session abond), checked the field online
and it
is
> still set to 1. Changed the code according to ray
>
> UserId=Sesssion ("User_Id")
> If UserId<>"" Then
> and also used variable UserId in select statement
> logged , checked the session ("User_Id) and it was 1 & logged off,
all > session variable were gone, checked the database, the online field was still
> 1.
>
>
> "PiGei" <ja***************@hotmail.com> wrote in message
> news:%2***************@tk2msftngp13.phx.gbl...
> > I had the same problem.
> > Check and see if the folder give access to the IIS Process Account
> > (IWAM_yourmachinename) to write into the db.
> >
> > Paolo
> >
> >
> > "Julian" <ep****@shaw.ca> wrote in message
> > news:%2***************@tk2msftngp13.phx.gbl...
> > > Hi
> > >
> > > I have code in my login.asp which sets the online field in user
> > database to
> > > true or 1. I am trying to use the same code in global.asa to

change > > back the
> > > online field to 0 but it doesn't work. The code is very simple and it
> > should
> > > work, any idea why it doesn't?
> > >
> > > Sub Session_OnEnd
> > > If Session("User_ID")<>" " Then ' check if user has

logged
> > in
> > > before.
> > > ConnectionString = "Driver={SQL
> > >
> >

Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111
> > .111
> > > .111.11\i1"
> > > Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
> > > Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
> > > Conn2Gallery.Open ConnectionString
> > > SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = "

& > > > Session("User_ID") & ")"
> > > SQL.CommandType = 1
> > > Set SQL.ActiveConnection = Conn2Gallery
> > > CmdTrackUser.Open SQL, , 1, 3
> > > CmdTrackUser.Fields("Online") = 0
> > > CmdTrackUser.Update
> > > CmdTrackUser.Close
> > > Set CmdTrackUser = Nothing
> > > Conn2Gallery.Close
> > > Set Conn2Gallery = Nothing
> > > END IF
> > >
> > >
> >
> >
>
>



Jul 19 '05 #9
What happens if you take out the "If Then" in your Session_OnEnd, so that
you're sure that the whole block of code isn't skipped?

Also, maybe this is just because of pasting or newsreader things, but your
SERVER value is 111.111.111.11\i1. Does your real code have this \i stuff
in it?

Ray at home
"Julian" <ep****@shaw.ca> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Here is the global.asa:
Sub Session_OnEnd
UserID = Session("User_ID")
If UserID <>"" Then
ConnectionString = "Driver={SQL
Server};UID=MEME;Password=BBBBBB;DATABASE=Mydataba se;SERVER=111.111.111.11\i 1"

Jul 19 '05 #10
Hi

The situation get stranger, the server Ip address is correct, I used in my
other programs but I have moved the whole part to a file called testme.asp
like this:
<%@ LANGUAGE="VBSCRIPT" %>
<%
UserID = Session("User_ID")
If UserID <>"" Then
ConnectionString = "Driver={SQL
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111.111
..111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID =" & UserID &
")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF

%>

Now after login, if I run my program to look at session variables:
The Session.Contents Collection
Variable: 'State_Province' =
Variable: 'Zipcode_Postal_Code' =
Variable: 'Phone' =
Variable: 'User_ID' = 1

now if I run the testme.asp, I get the following error message

Microsoft VBScript runtime error '800a01a8'

Object required: 'SQL'

/testme.asp, line 10 (this is the line with select statement, As I
mentioned before I use the same code to set the online field to true or 1)

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2******************@TK2MSFTNGP09.phx.gbl...
What happens if you take out the "If Then" in your Session_OnEnd, so that
you're sure that the whole block of code isn't skipped?

Also, maybe this is just because of pasting or newsreader things, but your
SERVER value is 111.111.111.11\i1. Does your real code have this \i stuff
in it?

Ray at home
"Julian" <ep****@shaw.ca> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Here is the global.asa:

Sub Session_OnEnd
UserID = Session("User_ID")
If UserID <>"" Then
ConnectionString = "Driver={SQL

Server};UID=MEME;Password=BBBBBB;DATABASE=Mydataba se;SERVER=111.111.111.11\i
1"


Jul 19 '05 #11
Shouldn't SQL actually be CmdTrackUser? Nowhere did you define SQL.

Ray at home
"Julian" <ep****@shaw.ca> wrote in message
news:uW**************@TK2MSFTNGP09.phx.gbl...
Hi

The situation get stranger, the server Ip address is correct, I used in my
other programs but I have moved the whole part to a file called testme.asp
like this:
<%@ LANGUAGE="VBSCRIPT" %>
<%
UserID = Session("User_ID")
If UserID <>"" Then
ConnectionString = "Driver={SQL
Server};UID=emenworldcom2;Password=BBBBBB;DATABASE =Mydatabase;SERVER=111.111 .111.11\i1"
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdTrackUser = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open ConnectionString
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID =" & UserID &
")"
SQL.CommandType = 1
Set SQL.ActiveConnection = Conn2Gallery
CmdTrackUser.Open SQL, , 1, 3
CmdTrackUser.Fields("Online") = 0
CmdTrackUser.Update
CmdTrackUser.Close
Set CmdTrackUser = Nothing
Conn2Gallery.Close
Set Conn2Gallery = Nothing
END IF

%>

Now after login, if I run my program to look at session variables:
The Session.Contents Collection
Variable: 'State_Province' =
Variable: 'Zipcode_Postal_Code' =
Variable: 'Phone' =
Variable: 'User_ID' = 1

now if I run the testme.asp, I get the following error message

Microsoft VBScript runtime error '800a01a8'

Object required: 'SQL'

/testme.asp, line 10 (this is the line with select statement, As I
mentioned before I use the same code to set the online field to true or 1)

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2******************@TK2MSFTNGP09.phx.gbl...
What happens if you take out the "If Then" in your Session_OnEnd, so that
you're sure that the whole block of code isn't skipped?

Also, maybe this is just because of pasting or newsreader things, but your SERVER value is 111.111.111.11\i1. Does your real code have this \i stuff in it?

Ray at home
"Julian" <ep****@shaw.ca> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Here is the global.asa:

Sub Session_OnEnd
UserID = Session("User_ID")
If UserID <>"" Then
ConnectionString = "Driver={SQL

Server};UID=MEME;Password=BBBBBB;DATABASE=Mydataba se;SERVER=111.111.111.11\i
1"



Jul 19 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
13
by: R Reyes | last post by:
is there a way to avoid the validateRequest error page in my code behind file? i can't seem to find a way to handle the error w/o an error code or exception being thrown... i am NOT looking for...
3
by: Ben Fidge | last post by:
I use the session_end in global.asax to perform clean-up of a temporary shopping cart table. Shoppping Cart items are stored with a session id in the table, and when a session ends a small rountine...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
10
by: m.epper | last post by:
Hi to everybody. First of all sorry for my english, I'm italian. How can I execute a portion of code, in a function, into the global scope? Example: <?php
7
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
15
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the...
5
by: =?Utf-8?B?bWNxd2VydHk=?= | last post by:
Hello, I'm trying to enable an error handling package at the root of my web server by editing this file: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config In the httpHandlers...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.