S
Steve
Not certain this is the correct newsgroup to post this, but I hope someone
here can help me. I am creating an array from a form field, parsing it, then
posting the data to a database using classic ASP. The problem I am
encountering is that the data is doubling up when posting. For example, if
there is only one item in the array, it will post twice. Below is the code I
am using: If anyone could be of any assistance, I sure would appreciate
it....
if Request.Form.Count > 0 then
if request.form("FormCouponCode") <> "" then
formCpnCode = trim(request.form("FormCouponCode"))
for i = 0 to 32
formCpnCode = replace(formCpnCode,chr(i),"")
next
codeArray = split(formCpnCode,",")
codeArrayCount = uBound(codeArray)
for i = 0 to codeArrayCount
item = codeArray(i)
sql = "SELECT bucksID, bcksNo, bcksOrderID, bcksValue,
bcksActive, bcksCpType FROM bobBucks WHERE bcksNo='" & item & "' and
(bcksActive='yes' or bcksActive='Yes')"
Set rst = Server.CreateObject("ADODB.RecordSet")
rst.Open sql, cnn
if rst.eof then
isCouponGood="no"
bckValue=0
else
isCouponGood=rst("bcksActive")
bckValue=rst("bcksValue")
end if
dim rSql,rst1
Set rst1 = Server.CreateObject("ADODB.RecordSet")
rSql = "Select * FROM sfTmpOrdersAE"
rst1.Open rSql, cnn, adOpenStatic, adLockOptimistic
rst1.AddNew
rst1("odrtmpSessionId") = Session("SessionID")
rst1("odrtmpCouponCode") = item
rst1("odrtmpIsActive") = isCouponGood
rst1("odrtmpValue") = bckValue
rst1.update
next
end if
end if
Steve
here can help me. I am creating an array from a form field, parsing it, then
posting the data to a database using classic ASP. The problem I am
encountering is that the data is doubling up when posting. For example, if
there is only one item in the array, it will post twice. Below is the code I
am using: If anyone could be of any assistance, I sure would appreciate
it....
if Request.Form.Count > 0 then
if request.form("FormCouponCode") <> "" then
formCpnCode = trim(request.form("FormCouponCode"))
for i = 0 to 32
formCpnCode = replace(formCpnCode,chr(i),"")
next
codeArray = split(formCpnCode,",")
codeArrayCount = uBound(codeArray)
for i = 0 to codeArrayCount
item = codeArray(i)
sql = "SELECT bucksID, bcksNo, bcksOrderID, bcksValue,
bcksActive, bcksCpType FROM bobBucks WHERE bcksNo='" & item & "' and
(bcksActive='yes' or bcksActive='Yes')"
Set rst = Server.CreateObject("ADODB.RecordSet")
rst.Open sql, cnn
if rst.eof then
isCouponGood="no"
bckValue=0
else
isCouponGood=rst("bcksActive")
bckValue=rst("bcksValue")
end if
dim rSql,rst1
Set rst1 = Server.CreateObject("ADODB.RecordSet")
rSql = "Select * FROM sfTmpOrdersAE"
rst1.Open rSql, cnn, adOpenStatic, adLockOptimistic
rst1.AddNew
rst1("odrtmpSessionId") = Session("SessionID")
rst1("odrtmpCouponCode") = item
rst1("odrtmpIsActive") = isCouponGood
rst1("odrtmpValue") = bckValue
rst1.update
next
end if
end if
Steve