467,122 Members | 1,269 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,122 developers. It's quick & easy.

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
  • viewed: 1827
Share:
11 Replies
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

45 posts views Thread by Steven T. Hatton | last post: by
171 posts views Thread by tshad | last post: by
10 posts views Thread by m.epper@gmail.com | last post: by
7 posts views Thread by Trickynick1001 | last post: by
15 posts views Thread by =?Utf-8?B?UGF0Qg==?= | last post: by
5 posts views Thread by =?Utf-8?B?bWNxd2VydHk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.