Solved

asp/vbscript runtime error 424

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Designing forms 3 68
Record locking on classic ASP 3 59
Adding Clickable Links to JQuery Data Items 24 53
ms sql string field to asp variable as number 5 30
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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 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