?
Solved

asp/vbscript runtime error 424

Posted on 2004-03-22
3
Medium Priority
?
1,807 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Accepted Solution

by:
ap_sajith earned 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 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