Solved

asp/vbscript runtime error 424

Posted on 2004-03-22
3
1,687 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

12 Experts available now in Live!

Get 1:1 Help Now