Is it possible to use ADO in global.asa?
I simply want to creat a log of each visit to the site?
Thanks,
-dmd- 7 4808
Yes. What do you want to, exactly? You can open an ADO connection, execute
a query, close and destroy your connection in Session_onStart , for example,
if you choose.
Ray at work
"Mac Davis" <ne**@blindside d.org> wrote in message
news:uM******** ******@TK2MSFTN GP12.phx.gbl... Is it possible to use ADO in global.asa? I simply want to creat a log of each visit to the site?
Thanks,
-dmd-
The follwing is in Session_Onstart
I know the connectionstrin g is correct because it works on other pages.
I simply want to add a record to do_userlog
---------------------------------------------------------------------
dim TimeSt
dim sq
dim sqlstr
sq = chr (39)
TimeSt = now
session ("connectionstr ing") = "Provider=SQLOL EDB.1; Data Source=xxxxx;
Initial Catalog=xxxxx; User ID=xxxxx;Passwo rd=xxxxx"
set objconn = server.createob ject ("ADODB.connect ion")
set objrec = server.createob ject ("ADODB.records et")
objconn.connect ionstring = session ("connectionstr ing")
sqlstr = "insert into do_userlog (timdate, logid, password, viewed) values
("
'sqlstr = sqlstr & sq & timest & sq & "," & sq & "0101150" & sq & "," & sq &
"004650" & sq & "," & sq & "F" & sq & ")"
sqlstr = "select * from do_events order by postdate desc"
objconn.open
objrec.open sqlstr, objconn, adOpenStatic, adLockReadOnly
set objrec = nothing
set objconn = nothing
----------------------------------------------------------------------------
--
The following error is returned
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/LM/W3SVC/1002338185/Root/global.asa, line 48
----------------------------------------------------------------------------
---
so, to simplify for troubleshooting I change sqlstr to sqlstr = "select *
from do_events order by postdate desc"
which works fine on other pages, and I receive exactly the same error.
-dmd-
"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l... Yes. What do you want to, exactly? You can open an ADO connection,
execute a query, close and destroy your connection in Session_onStart , for
example, if you choose.
Ray at work
"Mac Davis" <ne**@blindside d.org> wrote in message news:uM******** ******@TK2MSFTN GP12.phx.gbl... Is it possible to use ADO in global.asa? I simply want to creat a log of each visit to the site?
Thanks,
-dmd-
Mac Davis wrote: The follwing is in Session_Onstart I know the connectionstrin g is correct because it works on other pages. I simply want to add a record to do_userlog
--------------------------------------------------------------------- objconn.open objrec.open sqlstr, objconn, adOpenStatic, adLockReadOnly
The following error is returned ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
This error means that you do not have the ado constants (adOpenStatic, etc.)
defined on this page. You will either need to define them yourself (you can
look up the Const statements in the adovbs.inc file), or use the method
shown here: http://www.aspfaq.com/show.asp?id=2112
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Your first step would be to take this out of your onStart and put it in a
normal page so you can debug it. Then, instead of executing your sqlstr
query, response.Write it so you can see it. I think you may find that the
result is:
insert into do_userlog (timdate, logid, password, viewed) values(
You have the rest of your sqlstr commented out (').
Oh, wait, no, you're overwriting your first SQL query.
Also, since you're doing an insert, don't create a recordset. Just insert.
Also, did you define your adOpenStatic and adlockrEadOnly constants?
Also, "password" is a reserved SQL word, so you should bracket it.
Try this in a normal .asp file:
---------------------------------------------------------------------
dim TimeSt
dim sq
dim sqlstr
sq = chr (39)
TimeSt = now
session ("connectionstr ing") = "Provider=SQLOL EDB.1; Data
Source=xxxxx;In itial Catalog=xxxxx; User ID=xxxxx;Passwo rd=xxxxx"
sqlstr = "insert into do_userlog (timdate, logid, [password], viewed) values
("
sqlstr = sqlstr & sq & timest & sq & "," & sq & "0101150" & sq & "," & sq &
"004650" & sq & "," & sq & "F" & sq & ")"
objconn.open session("connec tionstring") ''careful
'objconn.execut e sqlstr
RESPONSE.WRITE SQLSTR
objconn.close
set objconn = nothing
---------------------------------------------------------------------
Ray at work
"Mac Davis" <ne**@blindside d.org> wrote in message
news:uS******** ******@TK2MSFTN GP10.phx.gbl... The follwing is in Session_Onstart I know the connectionstrin g is correct because it works on other pages. I simply want to add a record to do_userlog
--------------------------------------------------------------------- dim TimeSt dim sq dim sqlstr
sq = chr (39) TimeSt = now
session ("connectionstr ing") = "Provider=SQLOL EDB.1; Data Source=xxxxx; Initial Catalog=xxxxx; User ID=xxxxx;Passwo rd=xxxxx"
set objconn = server.createob ject ("ADODB.connect ion") set objrec = server.createob ject ("ADODB.records et")
objconn.connect ionstring = session ("connectionstr ing")
sqlstr = "insert into do_userlog (timdate, logid, password, viewed) values (" 'sqlstr = sqlstr & sq & timest & sq & "," & sq & "0101150" & sq & "," & sq
& "004650" & sq & "," & sq & "F" & sq & ")"
sqlstr = "select * from do_events order by postdate desc"
objconn.open objrec.open sqlstr, objconn, adOpenStatic, adLockReadOnly
set objrec = nothing set objconn = nothing --------------------------------------------------------------------------
-- -- The following error is returned ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/LM/W3SVC/1002338185/Root/global.asa, line 48
--------------------------------------------------------------------------
-- ---
so, to simplify for troubleshooting I change sqlstr to sqlstr = "select
* from do_events order by postdate desc"
which works fine on other pages, and I receive exactly the same error. -dmd- "Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message news:%2******** **********@TK2M SFTNGP11.phx.gb l... Yes. What do you want to, exactly? You can open an ADO connection, execute a query, close and destroy your connection in Session_onStart , for example, if you choose.
Ray at work
"Mac Davis" <ne**@blindside d.org> wrote in message news:uM******** ******@TK2MSFTN GP12.phx.gbl... Is it possible to use ADO in global.asa? I simply want to creat a log of each visit to the site?
Thanks,
-dmd-
Thanks Bob,
Added the constants and all is well.
If only the obvious were obvious I obviously wouldn't have to ask so many
questions.
-dmd-
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:uF******** ******@TK2MSFTN GP12.phx.gbl... Mac Davis wrote: The follwing is in Session_Onstart I know the connectionstrin g is correct because it works on other pages. I simply want to add a record to do_userlog
--------------------------------------------------------------------- objconn.open objrec.open sqlstr, objconn, adOpenStatic, adLockReadOnly
The following error is returned ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. This error means that you do not have the ado constants (adOpenStatic,
etc.) defined on this page. You will either need to define them yourself (you
can look up the Const statements in the adovbs.inc file), or use the method shown here: http://www.aspfaq.com/show.asp?id=2112
HTH, Bob Barrows
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Okay, now one more question.
The default page for this site is a frameset page with three .asp pages in
the frame.
What is happening now when someone visits the site is thatI get three logins
entries in the table for the initial visit. Is this because the three asp
pages are in effect accessed simultaneously?
What I want is one entry in the table every time someone hits the site. I
was doing this with a session variable. Seemed like doing it through the
global.asa was cleaner. any thoughts?
Thanks again
-dmd-
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:uF******** ******@TK2MSFTN GP12.phx.gbl... Mac Davis wrote: The follwing is in Session_Onstart I know the connectionstrin g is correct because it works on other pages. I simply want to add a record to do_userlog
--------------------------------------------------------------------- objconn.open objrec.open sqlstr, objconn, adOpenStatic, adLockReadOnly
The following error is returned ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. This error means that you do not have the ado constants (adOpenStatic,
etc.) defined on this page. You will either need to define them yourself (you
can look up the Const statements in the adovbs.inc file), or use the method shown here: http://www.aspfaq.com/show.asp?id=2112
HTH, Bob Barrows
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Thanks,
My problem was that I was referring to the constants in the adovbs.inc file
and the file was not included.
I added the constants to global.asa and it works fine.
-dmd-
"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l... Yes. What do you want to, exactly? You can open an ADO connection,
execute a query, close and destroy your connection in Session_onStart , for
example, if you choose.
Ray at work
"Mac Davis" <ne**@blindside d.org> wrote in message news:uM******** ******@TK2MSFTN GP12.phx.gbl... Is it possible to use ADO in global.asa? I simply want to creat a log of each visit to the site?
Thanks,
-dmd-
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Hitillambeau |
last post by:
Hi guys,
As I am new to Python, i was wondering how to declare and use global
variables. Suppose i have the following structure in the same module (same
file):
def foo:
<instructions>
<instructions>
def bar:
<instructions>
|
by: Andr? Roberge |
last post by:
I have the following two files:
#--testexec.py--
def exec_code(co):
try:
exec co
except:
print "error"
#-- test.py--
|
by: Lyn |
last post by:
Hi and Season's Greetings to all.
I have a question regarding the use of a qualifier word "Global". I cannot
find any reference to this in Access help, nor in books or on the Internet.
"Global" seems to be recognised by Access in at least three cases:-
1) "Global Const". Recently someone in this group helped me resolve a
problem, and it involved the use of a Global Const. By Googling "Global
Const", I got plenty of hits -- but they...
|
by: David P. Donahue |
last post by:
When I wrote websites in VB .NET, I would often put functions in Global
for all the pages to call. Now, in C#, doing so results in "references
to non-static objects" and whatnot. I realize what that means and all,
but what I'm wondering is what's the best way around it? Say, for
example, I want a function that takes a username and a password and
returns true or false if it's a successful login, and I want any page or
usercontrol in the...
|
by: fd123456 |
last post by:
Hi Tom !
Sorry about the messy quoting, Google is playing tricks on me at the
moment.
> Global.asax is where you normally have the Global Application
> and Session variables and code to manipulate them. It starts
> and ends with <script></script> tags.
>
> Yours looks like a compiled version of it.
| |
by: CDMAPoster |
last post by:
About a year ago there was a thread about the use of global variables
in A97:
http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157
Best Practices by Kang Su Gatlin, casual mention was made about using
static variables as an alternative to using global variables. This
caused me to think of the following:
'-----Begin module code
|
by: User1014 |
last post by:
A global variable is really just a property of the "Global Object", so
what does that make a function defined in the global context? A method
of the Global Object?
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Defining_Functions
doesn't actually give any insight.
|
by: Rob T |
last post by:
When I was using VS2003, I was able to compile my asp.net project locally on
my machine and copy it to the production server and it would run just fine.
I've now converted to VS2005. The project compiles & runs fine locally, but
when I copy to the production machine, I get this error:
Parser Error Message: Could not load type 'Global'.
Source Error:
Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="Global" %>
Source...
|
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...
|
by: weaknessforcats |
last post by:
C++: The Case Against Global Variables
Summary
This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have called it polluting the global namespace. This article explores what happens when the global namespace becomes polluted and how to avoid this condition.
The opinions expressed in this article are those of the author alone although many have...
|
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,...
| |
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,...
|
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...
|
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...
|
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();...
|
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...
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |