I am having troubles finding the right syntax to write a variable back to my SQL database to update entries. Basically I need to put the result of "SeatstoDB" into the "fieldname2" spot on the DB. Any help would be sooo appreciated.
Here's part of the code I have written so far:
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM KattCouponCode"
Set oRS = oConn.Execute(qry)
if not oRS.EOF then
while not oRS.EOF
CodefromDB = oRs.Fields(fieldname)
SeatsfromDB = oRs.Fields(fieldname2)
OutMessage = oRs.Fields(fieldname3)
ToURL = oRS.Fields(fieldname4)
If Code = CodefromDB and SeatsfromDB => 26 then
strURL = ToURL
response.write "<span style=""font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 24px;"">" & "<a href=""" & " & strURL & """ target=_blank>" & "Click here to take the test" & "</a>" & "</span>" & "<br>"
SeatstoDB = SeatsfromDB - 1
strSQL = "INSERT INTO KattCouponCode(fieldname2) Value (SeatstoDB)"
response.write (SeatstoDB)
else if Code = CodefromDB and DBSeatsfromDB < 20 then
response.write "<span style=""font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 24px;"">" & (OutMessage) & "</span>"
End If
End If
oRS.movenext
wend
oRS.close
end if
Set oRs = nothing
Set oConn = nothing
Here's part of the code I have written so far:
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM KattCouponCode"
Set oRS = oConn.Execute(qry)
if not oRS.EOF then
while not oRS.EOF
CodefromDB = oRs.Fields(fieldname)
SeatsfromDB = oRs.Fields(fieldname2)
OutMessage = oRs.Fields(fieldname3)
ToURL = oRS.Fields(fieldname4)
If Code = CodefromDB and SeatsfromDB => 26 then
strURL = ToURL
response.write "<span style=""font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 24px;"">" & "<a href=""" & " & strURL & """ target=_blank>" & "Click here to take the test" & "</a>" & "</span>" & "<br>"
SeatstoDB = SeatsfromDB - 1
strSQL = "INSERT INTO KattCouponCode(fieldname2) Value (SeatstoDB)"
response.write (SeatstoDB)
else if Code = CodefromDB and DBSeatsfromDB < 20 then
response.write "<span style=""font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 24px;"">" & (OutMessage) & "</span>"
End If
End If
oRS.movenext
wend
oRS.close
end if
Set oRs = nothing
Set oConn = nothing