...

View Full Version : Database update not working



Bazoz
01-31-2005, 01:05 PM
:confused:

Iím getting this error with the following asp page trying to update an access database.
Anyone got any ideas?

ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/admin/homesave.asp, line 25


<%@ Language="VBScript" %>
<% Option Explicit %>
<!--#include file="includes/adovbs.inc"-->
<%
Dim dbPath, dbConn, dbRS, redirURL, site, pageheading, button

site = cstr(Request.form("site"))
pageheading = cstr(Request.form("pageheading"))
button = cstr(Request.form("button"))

if button = " Edit " then
redirURL = "site=" &Server.URLencode(site)
redirURL = redirURL & "&pageheading=" &Server.URLencode(pageheading)
redirURL = "home.asp?"&redirURL
Response.Redirect redirURL
else
dbPath = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=d:\ace.mdb"

Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open = dbPath

Set dbRS = Server.CreateObject("ADODB.Recordset")
dbRS.Open "Home", dbConn, adOpenDynamic, adLockOptimistic, adCmdTable

dbRS.Find "siteID =" & site ĎLINE 25

dbRS("siteID") = site
dbRS("pageheading") = pageheading
dbRS.Update

dbRS.Close
set dbRS = Nothing

Response.Clear
Response.Redirect "welcome.asp"
End If

dbConn.close
set dbConn = nothing
%>

Bullschmidt
02-02-2005, 09:37 AM
Don't know the nature of the fields and thus if changing this:

dbRS.Find "siteID =" & site

To this might work (i.e. adding single quotes around the value because the field is a text field):

dbRS.Find "siteID ='" & site & "'"

And of course first perhaps check to be sure that the site variable isn't actually blank.

Bazoz
02-02-2005, 01:20 PM
Thanks Bullschmidt,

That fixed it. :thumbsup:

Bullschmidt
02-02-2005, 02:00 PM
You're welcome - glad to hear that the shot in the dark actually worked!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum