This is driving my crazy. I get an error ("500 - Internal server error.") on my web page when returning from this sub. It executes just fine and does what it's supposed to do: add a record of a user (MemID) to the Chat table for an event (EventID) if it hasn't already been added. The first query is to find out if there's already a record. If not, the INSERT statement adds a record. The error occurs after the sub has run.
Sub NewView (EventID)
MemID=Session("MemID")
If MemID>0 then
Set cn5=Server.CreateObject("ADODB.connection")
cn5.open application("gbConnect")
SQL="SELECT Chat.MemID, Chat.EventID FROM Chat WHERE Chat.MemID=" & MemID & " AND Chat.EventID=" & EventID & ";"
cn5.cursorLocation=3
Set Rst=cn5.execute(SQL)
If Rst.recordcount = 0 then
Comment="is watching"
SQL="INSERT INTO Chat ( MemID, EventID, Comment ) SELECT " & MemID & "," & EventID & ", '" & Comment & "';"
cn5.execute(SQL)
Set cn5=nothing
End If
End If
End Sub
On the page: NewView (EventID) 'Returning from this sub causes an error! "500 - Internal server error."