Hello,
The below code is from a BeforeAdd event - the dal Update portion works fine when alone. However, when used conditionally as below it does not update the table. Nor does it give an error - it just performs the response.redirect with no impact on the database.
Any suggestions would be appreciated.
str = "select * from Accounts where CardNo='" & dict("CardNo") & "' and SimNo='" & dict("SimNo") & "'"
Set rstmp = server.CreateObject("ADODB.Recordset")
rstmp.open str,dbConnection
if not rstmp.eof then
if rstmp("Username") <> "" then
Message = "This card has already been registered."
else
dal.Accounts.Param("CardNo") = dict("CardNo")
dal.Accounts.Value("Username") = SESSION("_Customers_OwnerID")
dal.Accounts.Update
BeforeAdd = False
rstmp.close
set rstmp = nothing
response.redirect "Accounts_list.asp"
end if
else
Message = "Please enter valid card details."
end if
BeforeAdd = False
rstmp.close
set rstmp = nothing