gpt4 book ai didi

asp-classic - 需要函数错误对象 800a01a8

转载 作者:行者123 更新时间:2023-12-02 04:58:40 24 4
gpt4 key购买 nike

我对函数和类比较陌生,所以不太确定这是否是初学者的错误。我得到:

Microsoft VBScript runtime error '800a01a8' 

Object required: 'EngineerNote(...)'

/backup-check/backup_frontendlist_import_NEW.asp, line 76

第 76 行是:

Set NoteArray=EngineerNote(company, servername, backupsolution)

我传递的三个变量都是字符串。所有函数和类都设置在:

Class EngineerNoteClass
public note
public notesubmitdate
End Class

Function EngineerNote(Company, ServerName, Solution)
Set RecordSet = Server.CreateObject("ADODB.Recordset")
RecordSetSQLString = "SELECT note, submitdate FROM tbl_BackupChecks_AuditInformation WHERE Company='" & company & "' AND ServerName='" & servername & "' AND Solution='" & solution & "' ORDER BY submitdate desc;"
RecordSet.Open RecordSetSQLString, DatabaseConnection
If Recordset.EOF Then
'Do Nothing
Else
Dim NoteResults
Set NoteResults = new EngineerNoteClass
noteresults.note = RecordSet("note")
noteresults.notesubmitdate = RecordSet("submitdate")
Set Engineernote = NoteResults
End If
Recordset.Close
End Function

最佳答案

很可能您的数据库查询没有返回任何结果。当记录集不在 EOF 时,您只设置函数的返回值:

If Recordset.EOF Then
'Do Nothing
Else
...
Set Engineernote = NoteResults
End If

Then 分支中将返回值设置为 Nothing(或空的 EngineerNoteClass 对象)应该会使错误消失:

If Recordset.EOF Then
Set EngineerNote = Nothing
Else
...
Set Engineernote = NoteResults
End If

确保在脚本的其余部分适本地处理返回的值/对象。

关于asp-classic - 需要函数错误对象 800a01a8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17468979/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com