Print Page | Close Window

Any ideas???

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9436
Printed Date: 01 April 2026 at 1:00am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Any ideas???
Posted By: Necronom
Subject: Any ideas???
Date Posted: 01 February 2004 at 4:18am

Here's the code:

If lngLoggedInUserID <> strAuthorID AND UserIsRegistered = 1 then
 strAccessDB = "/db/mydata.mdb"
 strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB)
 Set db = Server.CreateObject ("ADODB.Connection")
 db.Open strConnect
 Set rsAdd = Server.CreateObject ("ADODB.Recordset")
 rsAdd.Open "tblViews", strConnect, adOpenForwardOnly, adLockOptimistic
 rsAdd.AddNew
 rsAdd("fldAuthor") = strAuthorID
 rsAdd("fldVisitor") = strLoggedInUserName & "#" & lngLoggedInUserID
 rsAdd("fldDate") = Now()
 rsAdd("fldViewType") = "Profile"
 rsAdd.Update
 rsAdd.Close
 Set rsAdd = Nothing
 db.Close
 Set db = Nothing
End If

 

now...it goes through it, cuz if you put a Resp.Wr in the middle of the rsAdd("")'s it displays it. But, it's not adding anything to the DB! I've even forced bad field names trying to get an error, and nuttin!

any ideas?!

TIA!

. necronom .




Replies:
Posted By: pmormr
Date Posted: 01 February 2004 at 5:49pm
take a look at the ADO tutorial on this site under the ASP section

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Necronom
Date Posted: 02 February 2004 at 2:45am

ok.

Now, do you know that there's something wrong with the ADO structure, or are you guessing?

. necronom .



Posted By: MadDog
Date Posted: 02 February 2004 at 2:50am

Here is a better way of adding new records:

If lngLoggedInUserID <> strAuthorID AND UserIsRegistered = 1 then
 strAccessDB = "/db/mydata.mdb"
 strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB)
 
 Set db = Server.CreateObject ("ADODB.Connection")
 db.Open strConnect
 
 strSQL = "INSERT INTO tblViews (fldAuthor, fldVisitor, fldDate, fldViewType) VALUES ('" & strAuthorID & "', '" & strLoggedInUserName & "#" & lngLoggedInUserID & "', '" & Now() & "', '"Profile"');"
 db.Execute(strSQL)
 
 db.Close
 Set db = Nothing
End If



-------------
http://www.iportalx.net" rel="nofollow">


Posted By: Necronom
Date Posted: 02 February 2004 at 3:48am

Thank you MadDog...once again you are a genius ;)

. necronom .

http://BodyMod.org - http://BodyMod.org  <- in case you're curious what all this is for...




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net