navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Updating Records in Access Database

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Updating Records in Access Database
Page: [1]
 
wwagner

 

Posts: 2
Joined: 10/6/2004
Status: offline

 
Updating Records in Access Database - 10/6/2004 16:19:34   
I am updating records in an Access database. The users will see all the records and then choose which one to update. They will then be taken to an edit page where they can make their changes. When they submit their changes it calls an update page. My problem is that some of the records update fine, others will return a HTTP 500 Internal Server Error. Their is over 500 records in the table. Record #1 will update fine as will record #472. But record #2 will not and neither will record #11

Below is my update code:

<%
Vid = Request.form("ID")
response.Write(Request.form("ID"))
response.Write(Vid)
'Convert ID to Long int
lngRecordNo = CLng(Request.form("ID"))
Response.Write(lngRecordNo)

Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Inetpub\wwwroot\austin_officials\www\data\osis2.mdb;" & _
"Persist Security Info=False"

Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM High_Schools WHERE ID =" & 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
rsUpdateEntry.open SQL, dbConn

If Not rsUpdateEntry.EOF then
rsUpdateEntry.MoveFirst

'Update the records in the record set
rsUpdateEntry.Fields("School") = Request.Form("school")
rsUpdateEntry.Fields("Address") = Request.Form("address")
rsUpdateEntry.Fields("City") = Request.Form("city")
rsUpdateEntry.Fields("St") = Request.Form("state")
rsUpdateEntry.Fields("zip") = Request.Form("zip")
rsUpdateEntry.Fields("Phone") = Request.Form("phone")
rsUpdateEntry.Fields("Fax") = Request.Form("fax")
rsUpdateEntry.Fields("Coach") = Request.Form("coach")
rsUpdateEntry.Fields("Miles") = Request.Form("miles")
rsUpdateEntry.Fields("Flat Fee") = Request.Form("fee")

'Write the updated recordset to the database
rsUpdateEntry.Update
Response.Write("The following school " & rsUpdateEntry.Fields("School") & " has been updated!")
End if

'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set dbConn = Nothing

'Return to the update select page in case another record needs deleting
'Response.Redirect "record.asp"
%>

Any Help will be greatly appreciated
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Updating Records in Access Database - 10/6/2004 23:53:37   
To see the true error - IE > Tools > Options > Advanced > DONT show friendly http errors

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wwagner)
wwagner

 

Posts: 2
Joined: 10/6/2004
Status: offline

 
RE: Updating Records in Access Database - 10/7/2004 11:33:07   
That let me know what the problem really was. I had a field that could not be zero length. Thanks for putting me on the right path

(in reply to wwagner)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Updating Records in Access Database - 10/7/2004 12:43:28   
Yes, with Access its a good idea when you first create the database that all fields allow zero length - typically its not the case

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wwagner)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Updating Records in Access Database
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts