473,472 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2175
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.