A
Andrew
Hi,
I've got a function that outputs any errors that it encounters as it
loops through an array (using response.write). The function works
fine, but I'd like to dump any errors into an array, then loop through
that array and output errors that way. I'm not an ASP developer, so
just getting this to work was, eh, a journey
Basically, I'm asking some helpful developer to essentially insert
array functionality into the function below or provide helpful hints
(where/when to redim, how to loop through and output the array, and so
on) on how to use an array to replace strErrorMsg in the code below so
I can see how it is done. I've spent the last hour or so Googling for
answers, but found nothing that is applicable. Any help is greatly
appreciated. Thanks in advance!
Function UpdateAllUsers(strUpdateUserErrors)
Dim EditAllDataFields
Dim errorOccurred
EditAllDataFields = True
strErrorMsg = ""
For ws_intAgencyUserIdx = 0 To ws_intAgencyUserCnt-1
If ws_strAgencyUserPassword(ws_intAgencyUserIdx) <>
ws_strConfirmAgencyUserPassword(ws_intAgencyUserIdx) Then
strErrorMsg = "Error: Passwords do not match. ID " &
ws_strAgencyUserID(ws_intAgencyUserIdx) & "<br>"
EditAllDataFields = False
End If
If ucase(ws_strAgencyUserPassword(ws_intAgencyUserIdx)) =
ucase(ws_strAgencyUserID(ws_intAgencyUserIdx)) and EditAllDataFields =
True Then
strErrorMsg = "Error: Your User ID and your password cannot be the
same. ID "+ws_strAgencyUserID(ws_intAgencyUserIdx)
EditAllDataFields = False
End If
If len(ws_strAgencyUserPassword(ws_intAgencyUserIdx)) > 8 and
EditAllDataFields = True Then
strErrorMsg = "Error: Your password must be between 5 and 8
characters in length. ID "+ws_strAgencyUserID(ws_intAgencyUserIdx)
EditAllDataFields = False
End If
'***** more If statements commented out ...
If EditAllDataFields = True Then
ws_strWkAgencyUserUserSrc =
Mid(ws_strAgencyUserUserSrc(ws_intAgencyUserIdx)+" ",1,1)
ws_strNewPassEncrypt =
Encrypt(ws_strAgencyUserPassword(ws_intAgencyUserIdx))
If RunSQL("UPDATE AGENCY_SECURITY SET "+_
"PASSWORD = :ws_strNewPassEncrypt, "+_
"GROUP_ID = :ws_strAgencyUserGroupId(ws_intAgencyUserIdx), "+_
"USER_SOURCE = :ws_strWkAgencyUserUserSrc,"+_
"LAST_UPDATE_USER = :CurrentUser(), LAST_UPDATE_DATE =
:CurrentDate() "+_
"WHERE AGENCY_NO = :ws_strAgencyIdKey "+_
" AND USER_ID = :ws_strAgencyUserID(ws_intAgencyUserIdx) ") Then
strUpdateUserErrors = "Users Updated Successfully."
'strUpdateUserErrors &
UpdateAllUsers = True
Else
strUpdateUserErrors = strUpdateUserErrors & "Error: ERROR UPDATING
(Reimbursement Header)"+glbl_sqlErrorString
WriteStrMsg = "Error with " & ws_intAgencyUserIdx
End If
End IF
If strErrorMsg <> "" Then
response.write "<span style='color:red;font-family:Arial;
font-weight:bold;'>" & strErrorMsg & "</span>"
strErrorMsg = ""
errorOccurred=True
end if
Next
If errorOccurred Then
response.write "<hr><b>Click <a href='fixErrors.asp'>here</a> to
Continue.</b> <i>
End If
End Function
Thanks again.
Sincerely,
Andrew
I've got a function that outputs any errors that it encounters as it
loops through an array (using response.write). The function works
fine, but I'd like to dump any errors into an array, then loop through
that array and output errors that way. I'm not an ASP developer, so
just getting this to work was, eh, a journey
Basically, I'm asking some helpful developer to essentially insert
array functionality into the function below or provide helpful hints
(where/when to redim, how to loop through and output the array, and so
on) on how to use an array to replace strErrorMsg in the code below so
I can see how it is done. I've spent the last hour or so Googling for
answers, but found nothing that is applicable. Any help is greatly
appreciated. Thanks in advance!
Function UpdateAllUsers(strUpdateUserErrors)
Dim EditAllDataFields
Dim errorOccurred
EditAllDataFields = True
strErrorMsg = ""
For ws_intAgencyUserIdx = 0 To ws_intAgencyUserCnt-1
If ws_strAgencyUserPassword(ws_intAgencyUserIdx) <>
ws_strConfirmAgencyUserPassword(ws_intAgencyUserIdx) Then
strErrorMsg = "Error: Passwords do not match. ID " &
ws_strAgencyUserID(ws_intAgencyUserIdx) & "<br>"
EditAllDataFields = False
End If
If ucase(ws_strAgencyUserPassword(ws_intAgencyUserIdx)) =
ucase(ws_strAgencyUserID(ws_intAgencyUserIdx)) and EditAllDataFields =
True Then
strErrorMsg = "Error: Your User ID and your password cannot be the
same. ID "+ws_strAgencyUserID(ws_intAgencyUserIdx)
EditAllDataFields = False
End If
If len(ws_strAgencyUserPassword(ws_intAgencyUserIdx)) > 8 and
EditAllDataFields = True Then
strErrorMsg = "Error: Your password must be between 5 and 8
characters in length. ID "+ws_strAgencyUserID(ws_intAgencyUserIdx)
EditAllDataFields = False
End If
'***** more If statements commented out ...
If EditAllDataFields = True Then
ws_strWkAgencyUserUserSrc =
Mid(ws_strAgencyUserUserSrc(ws_intAgencyUserIdx)+" ",1,1)
ws_strNewPassEncrypt =
Encrypt(ws_strAgencyUserPassword(ws_intAgencyUserIdx))
If RunSQL("UPDATE AGENCY_SECURITY SET "+_
"PASSWORD = :ws_strNewPassEncrypt, "+_
"GROUP_ID = :ws_strAgencyUserGroupId(ws_intAgencyUserIdx), "+_
"USER_SOURCE = :ws_strWkAgencyUserUserSrc,"+_
"LAST_UPDATE_USER = :CurrentUser(), LAST_UPDATE_DATE =
:CurrentDate() "+_
"WHERE AGENCY_NO = :ws_strAgencyIdKey "+_
" AND USER_ID = :ws_strAgencyUserID(ws_intAgencyUserIdx) ") Then
strUpdateUserErrors = "Users Updated Successfully."
'strUpdateUserErrors &
UpdateAllUsers = True
Else
strUpdateUserErrors = strUpdateUserErrors & "Error: ERROR UPDATING
(Reimbursement Header)"+glbl_sqlErrorString
WriteStrMsg = "Error with " & ws_intAgencyUserIdx
End If
End IF
If strErrorMsg <> "" Then
response.write "<span style='color:red;font-family:Arial;
font-weight:bold;'>" & strErrorMsg & "</span>"
strErrorMsg = ""
errorOccurred=True
end if
Next
If errorOccurred Then
response.write "<hr><b>Click <a href='fixErrors.asp'>here</a> to
Continue.</b> <i>
End If
End Function
Thanks again.
Sincerely,
Andrew