473,769 Members | 5,846 Online
Bytes | Software Development & Data Engineering Community
+ 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_I D")<>" " Then ' check if user has logged in
before.
ConnectionStrin g = "Driver={SQ L
Server};UID=eme nworldcom2;Pass word=BBBBBB;DAT ABASE=Mydatabas e;SERVER=111.11 1
..111.11\i1"
Set Conn2Gallery = Server.CreateOb ject("ADODB.Con nection")
Set CmdTrackUser = Server.CreateOb ject("ADODB.Rec ordset")
Conn2Gallery.Op en ConnectionStrin g
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID = " &
Session("User_I D") & ")"
SQL.CommandType = 1
Set SQL.ActiveConne ction = Conn2Gallery
CmdTrackUser.Op en SQL, , 1, 3
CmdTrackUser.Fi elds("Online") = 0
CmdTrackUser.Up date
CmdTrackUser.Cl ose
Set CmdTrackUser = Nothing
Conn2Gallery.Cl ose
Set Conn2Gallery = Nothing
END IF
Jul 19 '05
11 2201
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="VBSCR IPT" %>
<%
UserID = Session("User_I D")
If UserID <>"" Then
ConnectionStrin g = "Driver={SQ L
Server};UID=eme nworldcom2;Pass word=BBBBBB;DAT ABASE=Mydatabas e;SERVER=111.11 1
..111.11\i1"
Set Conn2Gallery = Server.CreateOb ject("ADODB.Con nection")
Set CmdTrackUser = Server.CreateOb ject("ADODB.Rec ordset")
Conn2Gallery.Op en ConnectionStrin g
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID =" & UserID &
")"
SQL.CommandType = 1
Set SQL.ActiveConne ction = Conn2Gallery
CmdTrackUser.Op en SQL, , 1, 3
CmdTrackUser.Fi elds("Online") = 0
CmdTrackUser.Up date
CmdTrackUser.Cl ose
Set CmdTrackUser = Nothing
Conn2Gallery.Cl ose
Set Conn2Gallery = Nothing
END IF

%>

Now after login, if I run my program to look at session variables:
The Session.Content s 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******** **********@TK2M SFTNGP09.phx.gb l...
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******** ******@TK2MSFTN GP09.phx.gbl...
Here is the global.asa:

Sub Session_OnEnd
UserID = Session("User_I D")
If UserID <>"" Then
ConnectionStrin g = "Driver={SQ L

Server};UID=MEM E;Password=BBBB BB;DATABASE=Myd atabase;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******** ******@TK2MSFTN GP09.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="VBSCR IPT" %>
<%
UserID = Session("User_I D")
If UserID <>"" Then
ConnectionStrin g = "Driver={SQ L
Server};UID=eme nworldcom2;Pass word=BBBBBB;DAT ABASE=Mydatabas e;SERVER=111.11 1 .111.11\i1"
Set Conn2Gallery = Server.CreateOb ject("ADODB.Con nection")
Set CmdTrackUser = Server.CreateOb ject("ADODB.Rec ordset")
Conn2Gallery.Op en ConnectionStrin g
SQL.CommandText = "SELECT Users.* FROM Users WHERE (User_ID =" & UserID &
")"
SQL.CommandType = 1
Set SQL.ActiveConne ction = Conn2Gallery
CmdTrackUser.Op en SQL, , 1, 3
CmdTrackUser.Fi elds("Online") = 0
CmdTrackUser.Up date
CmdTrackUser.Cl ose
Set CmdTrackUser = Nothing
Conn2Gallery.Cl ose
Set Conn2Gallery = Nothing
END IF

%>

Now after login, if I run my program to look at session variables:
The Session.Content s 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******** **********@TK2M SFTNGP09.phx.gb l...
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******** ******@TK2MSFTN GP09.phx.gbl...
Here is the global.asa:

Sub Session_OnEnd
UserID = Session("User_I D")
If UserID <>"" Then
ConnectionStrin g = "Driver={SQ L

Server};UID=MEM E;Password=BBBB BB;DATABASE=Myd atabase;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
3624
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 themselves are an exception to this), and 'bootstrap' your program by instantiating a single application object in main(), would that place any limitations on what you could accomplish with your program? Are there any benefits to doing things that...
13
7581
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 a link that explains what it does and what it doesn't do OR the pros/cons, as i've already read through many of those. i just want to know if i can code some sort of exception to catch for it so that the ugly yellow/white microsoft generic page...
3
1424
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 checks the shopping cart table and deletes any stray items. This has worked a treat for weeks but stopped working today when I uploaded news dlls and aspx pages to the live server using FTP. Nothing has changed code-wise and all relevant...
171
7796
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) like it because you can split the code from the design. That is logical. But if you are the only one working on the code, it seem a little overkill. I use Dreamweaver to do my design and find it a bit of a hassle to have multiple files open...
5
15151
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
10
3898
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
1780
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 problem is with this code, it just simply won't work properly. Some of the functions aren't done, but the main one gives me a Not a Number message in the text box where the calculations are supposed to come up. I tried to use a parseInt on my stuff,...
15
2573
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 Global class. Note: I use these shared variables for read only values that are set at application start. It would appear the 2.0 doesn't like you to use shared variables in the global class. How do I convert my 1.1 applications to 2.0 without...
5
4514
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 section I've added: <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah, Version=1.0.9414.0, Culture=neutral, PublicKeyToken=42734318a98ac1df"
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.