Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - what is wrong with this script
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

what is wrong with this script

 Post Reply Post Reply Page  12>
Author
shiranve View Drop Down
Newbie
Newbie


Joined: 31 January 2004
Location: Israel
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote shiranve Quote  Post ReplyReply Direct Link To This Post Topic: what is wrong with this script
    Posted: 31 January 2004 at 4:33am

Can you please tell me what is wrong with this script why it is not adding recoreds to the DB?

<%
'Dimension variables
Dim adoCon         'Holds the Database Connection Object
Dim rswedding   'Holds the recordset for the records in the database
Dim strSQL          'Holds the SQL query to query the database
Dim strDbPathAndName  'Holds the path and name of the database
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

strDbPathAndName ="C:\Inetpub\DB\wedding.mdb"
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName

'Create an ADO recordset object
Set rswedding = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT gues.surename, gues.name1, gues.name2, gues.childname, gues.hophone, gues.workphone, gues.mobphone, gues.email, gues.guestnum, gues.checkbox, gues.text FROM gues;"

'Set the cursor type we are using so we can navigate through the recordset
rswedding.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
rswedding.LockType = 3
'Open the recordset with the SQL query
rswedding.Open strSQL, adoCon

rswedding.AddNew
'Add a new record to the recordset
rswedding.Fields("surename") = Request.Form("surename")
rswedding.Fields("Name1") = Request.Form("name1")
rswedding.Fields("Name2") = Request.Form("name2")
rswedding.Fields("childname") = Request.Form("childname")
rswedding.Fields("hophone") = Request.Form("hophone")
rswedding.Fields("workphone") = Request.Form("workphone")
rswedding.Fields("mobphone") = Request.Form("mobphone")
rswedding.Fields("email") = Request.Form("email")
rswedding.Fields("guestnum") = Request.Form("guestnum")
rswedding.Fields("checkbox") = Request.Form("checkbox")
rswedding.Fields("text") = Request.Form("text")
'Write the updated recordset to the database
rswedding.Update
'Reset server objects
rswedding.Close
Set rswedding = Nothing
'Set adoCon = Nothing
Response.Redirect "register.asp"
%>

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 8:33am

do you get errors?
if so, where do you get the error at?

can't expect to just chuck up 40-or-so lines of code and say "fix it"

Contribute to the working anarchy we fondly call the Internet
Back to Top
shiranve View Drop Down
Newbie
Newbie


Joined: 31 January 2004
Location: Israel
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote shiranve Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 8:50am

I know

If I was getting any kind of Error Message I would Have sent it but the problem is that I am not getting any thing it is not updating the DB and not getting to the redirect back!

Do you have any suggestions?

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 9:20am
check if your database has read and write access..
Back to Top
shiranve View Drop Down
Newbie
Newbie


Joined: 31 January 2004
Location: Israel
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote shiranve Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 11:59am
 This is the error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/add_user.asp, line 15

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 12:02pm
Can you post line 15 of add_user.asp (and a few lines above and below)
Back to Top
shiranve View Drop Down
Newbie
Newbie


Joined: 31 January 2004
Location: Israel
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote shiranve Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 12:15pm

Dim adoCon         'Holds the Database Connection Object
Dim rswedding   'Holds the recordset for the records in the database
Dim strSQL          'Holds the SQL query to query the database
Dim strDbPathAndName  'Holds the path and name of the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

strDbPathAndName ="C:\Inetpub\DB\wedding.mdb"
'Set an active connection to the Connection object using a DSN-less connection
line 15>>rswedding.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName

 

 

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2004 at 12:26pm
Change

rswedding.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName

To

adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName
Back to Top
 Post Reply Post Reply Page  12>

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.