TennesseeGuy
02-10-2005, 02:50 PM
I have put together a script that works beautifully when attempting to update a record. However if two records end up having the same criteria then only one will process and the other will lock up forever. Can anyone help me get this smple sql update to work with multiple recordsets?
strSql = "SELECT * FROM " & strMemberTablePrefix & "MEMBERS "
set rs3 = my_Conn.Execute (strSql)
pMemID = rs3("MEMBER_ID")
pWarn = rs3("M_WARN")
pWarnDate = rs3("M_WARNDATE")
if len(pWarnDate&"")=0 then
pWarnDate= 0
else
pWarnDate = Int(pWarnDate)
end if
mWarn = pWarnDate
nWarnDate = Int(DateToStr(dtDateTime))
nWarn = nWarnDate
If pWarn = 0 then
rs3.close
Else
If (pWarn = 1) and (mWarn < nWarn - 60) then
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARN = 0 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARNDATE = 0 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
End If
If (pWarn = 2) and (mWarn < nWarn - 120) then
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARN = 1 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARNDATE = " & nWarn &" where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
End If
If pWarn > 2 then
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARN = 2 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
End If
rs3.close
End If
strSql = "SELECT * FROM " & strMemberTablePrefix & "MEMBERS "
set rs3 = my_Conn.Execute (strSql)
pMemID = rs3("MEMBER_ID")
pWarn = rs3("M_WARN")
pWarnDate = rs3("M_WARNDATE")
if len(pWarnDate&"")=0 then
pWarnDate= 0
else
pWarnDate = Int(pWarnDate)
end if
mWarn = pWarnDate
nWarnDate = Int(DateToStr(dtDateTime))
nWarn = nWarnDate
If pWarn = 0 then
rs3.close
Else
If (pWarn = 1) and (mWarn < nWarn - 60) then
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARN = 0 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARNDATE = 0 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
End If
If (pWarn = 2) and (mWarn < nWarn - 120) then
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARN = 1 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARNDATE = " & nWarn &" where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
End If
If pWarn > 2 then
strSql = "update " & strMemberTablePrefix & "MEMBERS set M_WARN = 2 where MEMBER_ID=" & pMemID
my_Conn.Execute (strSql)
End If
rs3.close
End If