Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Any ideas???
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Any ideas???

 Post Reply Post Reply
Author
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post Topic: Any ideas???
    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 .



Edited by Necronom
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 01 February 2004 at 5:49pm
take a look at the ADO tutorial on this site under the ASP section
Back to Top
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post 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 .

Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2004 at 3:48am

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

. necronom .

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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.