Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2007, 06:23 PM
Registered User
 
Join Date: Mar 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update.Entry causes HTTP 500 errors ??

I have a very basic Access database of clients and the related agent dealing with each client .

I have an asp form to allow users to change the Agent Code for a selected client . So the form only has two fields

ClientID
AgentCode

Up to here everything works fine .

The Action for the form is to POST to a page called update.asp .

I used code for this update.asp page from a very similar one which works perfectly on another server.

However , in this case (on adifferent server ) I keep getting HTTP Server 500 error when submitting the form .

I have checked the code over and over but cannot see what the problem is other than I have narrowed it down to the three lines of "UpdateEntry" code shown here (beacause when these are commented out the code runs and redirects as per the last line)

rsUpdateEntry.Fields("AgentCode") = Request.Form("AgentCode")

UpdateEntry.Update

rsUpdateEntry.Close


the full code of the upadte.asp page is shown below , HELP !! much appreciated

<%

'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
Dim gstrConnectToDatabase 'Holds the recordset for the records in the database

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

gstrConnectToDatabase = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\hosting\dixona\sai\db\webpropertydb.mdb; Persist Security Info=False"

'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ClientID"))

'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tbl_clients.* FROM tbl_clients WHERE ClientID=" & lngRecordNo

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

'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3

'Open the tbl_Clients table using the SQL query held in the strSQL varaiable
rsUpdateEntry.Open strSQL, gstrConnectToDatabase

'Update the record in the recordset
'rsUpdateEntry.Fields("AgentCode") = Request.Form("AgentCode")

'Write the updated recordset to the database
UpdateEntry.Update

'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set adoCon = Nothing
Set gstrConnecToDatabase = Nothing


Response.Redirect "WebClients.asp"
%><head><title>Web Clients</title></head>






 
Old March 8th, 2007, 08:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

why you have UpdateEntry.Update and not RsUpdateEntry.Update??

that's only a mistype?

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
 
Old March 9th, 2007, 04:25 PM
Registered User
 
Join Date: Mar 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply
that was a typo

Its one or both of these lines which are definetley causing the problem

rsUpdateEntry.Fields("AgentCode") = Request.Form("AgentCode")
rsUpdateEntry.Update

Cheers
John

 
Old September 7th, 2007, 06:28 PM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

John,

Did you ever get a satisfactory answer to this 500 error problem? I have not been able to find one and there is one user who complains about the same behavior when he submits one of my forms.

I could not replicate his error when I accessed the form he's using, but of course! he was not happy with my "Well it works on my machine" joke.

Let me know if you've found an answer.



Best,

Frank





Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP status report : 500 rmukeshauto Struts 0 October 4th, 2006 04:52 AM
http 500 - -2147467259 (0x80004005) harminder JSP Basics 2 August 20th, 2006 11:15 AM
any help for http 500? zhoukan_china .NET Framework 1.x 0 January 27th, 2006 03:31 AM
Http Status 500 ashutosh9910 Apache Tomcat 0 December 22nd, 2004 03:04 AM
HTTP 500 error pjdas JSP Basics 0 November 21st, 2003 02:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.