Hi all,
I'm trying to get this mass update ASP code to work for an Access database, but everytime I hit update, it just return the same original values... unlike it worked with the MS SQL database I worked with before. I wonder that there could be something different between SQL and Access causing it... Could someone please tell!!!
I'm trying to get this mass update ASP code to work for an Access database, but everytime I hit update, it just return the same original values... unlike it worked with the MS SQL database I worked with before. I wonder that there could be something different between SQL and Access causing it... Could someone please tell!!!
Code:
'declare the variables
Response.Buffer = true
On Error Resume Next
Dim strErrorMessage
Dim bolErrors
'Initialize variables
strErrorMessage = "" 'The error messages for tech. support
bolErrors = False 'Have we found any errors yet?
'Now our two subs
sub TrapError(strError)
bolErrors = True 'we've found an error!
strErrorMessage = strErrorMessage & strError & ", "
end sub
'first, get the total # of items that could be updated
Dim icount
icount = request.form("count")
'variables: id, name, selected template
Dim tid,tname,tselect
Dim iLoop, iString, arrCols
'get current page
pCurPage = Request.form("curPage")
For iLoop = 0 to icount
tname = Request.form(iLoop & ".tempName")
tselect = Request.form("tempSelected")
sDelete = Request.form(iLoop & ".delete")
' if NOT numberValidation(sDelete) then
' response.Redirect "error.asp?msg=" & Server.URLEncode("Invalid ID to delete!")
' end if
strID = Request.form(iLoop & ".idTemplate")
' if NOT numberValidation(strID) then
' response.Redirect "error.asp?msg=" & Server.URLEncode("Invalid ID to update!")
' end if
'update the appropriate column
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorType = 2
rs.LockType = 3
rs.Open "SELECT tempName,tempSelected FROM Templates WHERE idTemplate = " & cint(strID), objConn
if len(tname)>0 then
rs.Fields("tempName") = lcase(tname)
end if
if len(tselect)>0 then
rs.Fields("tempSelected") = tselect
end if
rs.Update
if len(sDelete) > 0 then
'Delete records from ProductSupport
strSQL = "DELETE FROM Templates " _
& " WHERE idTemplate = " & trim(sDelete)
objConn.Execute strSQL
end if
If Err.number <> 0 then
TrapError Err.description
End If
Next
call closeRS(rs)
call closedb()