質問

I am working on some legacy code that is written in Classic ASP / VBSCript.

The code handles the data submitted via a HTML form, and breaks on the following line.

' Get all input questions
Set inputQuestions = getListOfInputQuestionsForPage("additional")

The function getListOfInputQuestionsForPage(pageName) is defined as follows:

Function getListOfInputQuestionsForPage(pageName)
    ' Instantiate Command
    Set objCommand = Server.CreateObject("ADODB.Command")

    ' Inform Command what Connection to use.
    Set objCommand.ActiveConnection = myConn

    ' SQL Query to run
    objCommand.CommandText = "SELECT QUESTION_TABLE.PK_QUESTION AS ""QUESTION_ID"", QUESTION_TABLE.QUESTION AS ""QUESTION"", QUESTION_TABLE.INPUT_TYPE AS ""TYPE"", QUESTION_TABLE.IS_FOR_ALL_CUSTOMERS AS ""FOR_ALL_CUSTOMERS"" FROM QUESTION_TABLE WHERE QUESTION_TABLE.DISPLAY_PAGE = '" & pageName & "' ORDER BY PK_QUESTION ASC"

    ' Execute SQL and return result
    Set getListOfInputQuestionsForPage = objCommand.Execute()
End Function

I find it strange that I am getting the following error:

Microsoft VBScript runtime  error '800a000d'

Type mismatch: 'getListOfInputQuestionsForPage' 

/site/path_to_file/edit_additional.asp, line 110

All I am doing is trying to grab some data from the database. And I know the data exists and a RecordSet is returned.

役に立ちましたか?

解決

The error threw me off. The reason why it wasn't working was because the function getListOfInputQuestionsForPage(pageName) did not exist on the same page, and I had to include the file that contained the function definition, which now is very obvious, but because the error is so weird for what I'm trying to do (type mismatch) ... I did not think of that reason at all.

So in short, make sure your classic asp file knows about that function, ie has a link to the file containing the function, or the function is defined in the same file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top