asp_ado_rds thread: Problem Deleting Multiple records using (rsJobs.Delete adAffectGroup)
I am having a problem deleting multiple records using the ADO Recordset.
I get the following error message
'**********************************
ADODB.Recordset error '800a0bb9'
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
/delete_multi_job_records.asp, line 57
'**********************************
Below is my code
=================
<% Language=VBScript %>
<% Response.Buffer=TRUE %>
<html>
<head>
<title> Jobs being deleted using recordset </title>
</head>
<body>
<%
SUB UpdateJobs
Dim jobid, jobdesc, minVal, maxVal
jobid = Request.Form("job_id")
if IsNumeric(jobid) then
jobid = cint(jobid)
end if
jobdesc = Request.Form("job_desc")
minVal = Request.Form("min_val")
if IsNumeric(minVal) Then
minVal = cint(minVal)
end if
maxVal = Request.Form("max_val")
if IsNumeric(maxVal) Then
maxVal = cint(maxVal)
end if
Set DBconn = Server.CreateObject("ADODB.Connection")
DBconn.ConnectionTimeout = Application("fran_ConnectionTimeout")
DBconn.CommandTimeout = Application("fran_CommandTimeout")
DBconn.Open Application("fran_ConnectionString"), Application("fran_RuntimeUserName"), Application("fran_RuntimePassword")
Set rsJobs = Server.CreateObject("ADODB.Recordset")
rsJobs.Source = "fran..jobs" 'Table name
rsJobs.ActiveConnection = DBconn
rsJobs.CursorType = 1 'Keyset
rsJobs.Locktype = 4 'Batch Optimistic
rsJobs.Filter = "job_id >= " & jobid 'Returns multiple records
rsJobs.Open
if rsJobs.EOF Then
Response.Write ("<h1>Record not found.."& cint &"</h1>")
else
rsJobs.Delete adAffectGroup '***This does not work***
' rsJobs.Delete (this works fine)
if err.Number <> 0 then
Response.Write(Err.Description &"<BR>")
else
Response.Write("<font color=""green""><p><strong> Jobid successfully updated - " & jobid &"</strong>
</p></font>")
end if
end if
rsJobs.Close
DBconn.Close
Set DBconn = Nothing
End Sub
' ###################### End SUB ######################
' First check to see if the form data has been filled in.
if Isnull(request.Form("job_id")) then
Response.Write ("No Data found to update")
Response.End
else
Call UpdateJobs
end if
%>
</body>
</html>
When I try to delete multiple record at a time using just
rsJobs.Delete adAffectGroup it returns the above mentioned error.
It works fine if I just use rsJobs.Delete i.e. it deletes 1 record.
I need to know how to delete multiple records using recordset.
Thanks,
Deb.