Solved

asp/vbscript runtime error 424

Posted on 2004-03-22
3
1,704 Views
Last Modified: 2012-06-22
I am trying to update a microsoft access database via asp page using an update sql query.
When submitting the page the error message that occurs by using the err.number after the query executing the message is "error 424".
There is no file permission error at all. I have made sure that the database file itself has a full read and write permissions and security access rights are set correctly throughout. eg, "everyone" and "anonymous internet user" etc

The asp is running on IIS 5.0 on 2k server

The select query using the object stated below works previously on other pages to retrieve data, but  not to update.
There is an object required according to the error code, but it has not become apparent to myself.

Code is below;


<html>
<head>
<title>Submit DataBase</title>
</head>
<body>
<h2>Submit to Database</h2>

<%on error resume next

'dim conn as adodb.connection
'dim no as string
'dim sql as string
'dim err as exception

dim conn
set conn=Server.CreateObject("ADODB.Connection")
conn.provider="Microsoft.Jet.OLEDB.4.0"
'conn.Mode = 3 ' 3 = adModeReadWrite
conn.open(server.mappath("hotel.mdb"))

 if Request.form("action")="Save" then
      no=Request.Form("no")
      sql="UPDATE bookings SET [CustomerName]='" & Request.Form("CustomerName") & "',"
      sql=sql & "[telNo]='" & Request.Form("telNo") &  "' WHERE bookings.[BookingID]=" & no

     

 conn.Execute sql, Recordsaffected
 reponse.write(sql)
 if err <> 0 then
       response.write(err.number)
       'Response.Write("Permission denied")
 else
       Response.Write("Record number " & no & " was updated.")
 end if
 end if  


conn.close%>


</body>
</html>


if you require additional source code, then please reply and this will be provided, either on this page, or in a file format in a method of your choosing.

Please help me out, this is doing my head in!!

Thanks

Gary








0
Comment
Question by:sarczoid
3 Comments
 
LVL 21

Accepted Solution

by:
ap_sajith earned 250 total points
ID: 10655379
Try this..

<%on error resume next

'dim conn as adodb.connection
'dim no as string
'dim sql as string
'dim err as exception

dim conn
set conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("hotel.mdb") &";User Id=;Password=;"

 if Request.form("action")="Save" then
      no=Request.Form("no")
      sql="UPDATE bookings SET [CustomerName]='" & Request.Form("CustomerName") & "',"
      sql=sql & "[telNo]='" & Request.Form("telNo") &  "' WHERE bookings.[BookingID]=" & no

     

 conn.Execute (sql)
 reponse.write(sql)
 if err <> 0 then
      response.write(err.number)
      'Response.Write("Permission denied")
 else
      Response.Write("Record number " & no & " was updated.")
 end if
 end if  


conn.close
' ** CLEANUP**
set conn=nothing
%>


</body>

Cheers!
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10657278
Never put "on error resume next" in your code until your absolutely sure it works.  I then I wouldn't do it either...but that's up to you.

If you take it out, ASP Runtime will tell you where the error is and what the problem is.  Then you can post that error message here, and we will solve your problem.
0
 

Author Comment

by:sarczoid
ID: 10658109
ap_sajith,

thankyou for your help, i accepted your answer.

thanks

Gary
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now