I'm adding this answer here, though I realise this is very much later than when the question was first answered. I'm putting the answer here in case it saves anyone else the hassle I've just been through.
I too was getting this error on my ASP page after I had re-installed Windows 10. Previously on my localhost IIS setup, the same page did not error. However - now it did - with the following error:
Active Server Pages error 'ASP 0115' Unexpected error index.asp
A trappable error (C0000005) occurred in an external object. The script cannot continue running.
I tried lots of things to try and sort it, such as:
- Reinstalling Windows 10 again
- Reinstalling IIS on the new Windows 10 installation
- Trying all sorts of combinations of versions of MySQL and the ODBC Connector
- Checking for missing files in Windows Process Monitor as per one of the answers on this page
- Messing about with Application Pools
- Messing about with lots of versions of Microsoft Visual C++ Redistributables
My problem was with an SQL Insert - when it ran, I got the error.
This is a cut down version of it:
sql = ""
sql = sql & " INSERT INTO my_table ( "
sql = sql & " card_sender, "
sql = sql & " senders_email, "
sql = sql & " recipients_email, "
sql = sql & " card_body, "
sql = sql & " session_id, "
sql = sql & " replyID) VALUES ( "
sql = sql & " ?, "
sql = sql & " ?, "
sql = sql & " ?, "
sql = sql & " ?, "
sql = sql & " ?, "
sql = sql & " ?) "
Set stmt = Server.CreateObject("ADODB.Command")
stmt.ActiveConnection = oConn
stmt.Prepared = true
stmt.commandtext = sql
stmt.Parameters.Append stmt.CreateParameter("@001_card_sender", adVarChar, adParamInput, 255, card_sender)
stmt.Parameters.Append stmt.CreateParameter("@002_senders_email", adVarChar, adParamInput, 255, senders_email)
stmt.Parameters.Append stmt.CreateParameter("@003_recipients_email", adVarChar, adParamInput, 255, recipients_email)
stmt.Parameters.Append stmt.CreateParameter("@004_card_body", adLongVarChar, adParamInput, 256665, card_body)
stmt.Parameters.Append stmt.CreateParameter("@sessionsessionID", adVarChar, adParamInput, 255, session.sessionID)
stmt.Parameters.Append stmt.CreateParameter("@replyID", adVarChar, adParamInput, 255, session("replyID"))
stmt.Execute
Set stmt = Nothing
Via a process of building up the SQL and finding which line triggered the error, I found this line caused the problem:
stmt.Parameters.Append stmt.CreateParameter("@replyID", adVarChar, adParamInput, 255, session("replyID"))
In my example, the session("replyID")
value was not set, and that triggered the error.
When I changed the code to check if the session variable was set, it fixed the issue:
...
foo = session("replyID")
if foo = "" then foo = 1
...
stmt0003.Parameters.Append stmt0003.CreateParameter("@replyID", adVarChar, adParamInput, 255, foo)
More testing confirmed that the error would happen for any variable which was null, so I had to add in an if statement for every variable and set it to something if it was null, to prevent these errors which I didn't used to get on a previous Windows 10 installation on the same PC.
After spending about a day working on it, it was a relief to get to the bottom of it.