Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ADO in global.asa

Reply
Thread Tools

ADO in global.asa

 
 
Mac Davis
Guest
Posts: n/a
 
      12-30-2003
Is it possible to use ADO in global.asa?
I simply want to creat a log of each visit to the site?

Thanks,

-dmd-


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      12-30-2003
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" <> wrote in message
news:...
> Is it possible to use ADO in global.asa?
> I simply want to creat a log of each visit to the site?
>
> Thanks,
>
> -dmd-
>
>



 
Reply With Quote
 
 
 
 
Mac Davis
Guest
Posts: n/a
 
      12-30-2003
The follwing is in Session_Onstart
I know the connectionstring 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 ("connectionstring") = "Provider=SQLOLEDB.1; Data Source=xxxxx;
Initial Catalog=xxxxx; User ID=xxxxx;Password=xxxxx"

set objconn = server.createobject ("ADODB.connection")
set objrec = server.createobject ("ADODB.recordset")

objconn.connectionstring = session ("connectionstring")

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:%23AJf%...
> 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" <> wrote in message
> news:...
> > Is it possible to use ADO in global.asa?
> > I simply want to creat a log of each visit to the site?
> >
> > Thanks,
> >
> > -dmd-
> >
> >

>
>



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      12-30-2003
Mac Davis wrote:
> The follwing is in Session_Onstart
> I know the connectionstring 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.


 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      12-30-2003
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 ("connectionstring") = "Provider=SQLOLEDB.1; Data
Source=xxxxx;Initial Catalog=xxxxx; User ID=xxxxx;Password=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("connectionstring") ''careful
'objconn.execute sqlstr
RESPONSE.WRITE SQLSTR
objconn.close
set objconn = nothing
---------------------------------------------------------------------


Ray at work










"Mac Davis" <> wrote in message
news:...
> The follwing is in Session_Onstart
> I know the connectionstring 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 ("connectionstring") = "Provider=SQLOLEDB.1; Data Source=xxxxx;
> Initial Catalog=xxxxx; User ID=xxxxx;Password=xxxxx"
>
> set objconn = server.createobject ("ADODB.connection")
> set objrec = server.createobject ("ADODB.recordset")
>
> objconn.connectionstring = session ("connectionstring")
>
> 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:%23AJf%...
> > 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" <> wrote in message
> > news:...
> > > Is it possible to use ADO in global.asa?
> > > I simply want to creat a log of each visit to the site?
> > >
> > > Thanks,
> > >
> > > -dmd-
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Mac Davis
Guest
Posts: n/a
 
      12-30-2003
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" <> wrote in message
news:...
> Mac Davis wrote:
> > The follwing is in Session_Onstart
> > I know the connectionstring 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.
>
>



 
Reply With Quote
 
Mac Davis
Guest
Posts: n/a
 
      12-31-2003
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" <> wrote in message
news:...
> Mac Davis wrote:
> > The follwing is in Session_Onstart
> > I know the connectionstring 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.
>
>



 
Reply With Quote
 
Mac Davis
Guest
Posts: n/a
 
      12-31-2003
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:%23AJf%...
> 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" <> wrote in message
> news:...
> > Is it possible to use ADO in global.asa?
> > I simply want to creat a log of each visit to the site?
> >
> > Thanks,
> >
> > -dmd-
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Translating Oracle Package Call from ADO to ADO.Net dmiratsky@yahoo.com ASP .Net 0 02-14-2005 10:39 PM
Transfer ADO Code to ADO.NET ronaldlee ASP .Net 1 12-17-2004 04:08 PM
Accessing an ADO Recordset or Record from ADO.NET nita ASP .Net 1 11-20-2004 07:06 AM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM
Next Evolution in ADO.NET Carlos Santana ASP .Net 0 08-14-2003 06:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57