How does the classic asp connection.errors collection actually work?

久未见 提交于 2020-08-19 08:42:31

问题


I am trying to confirm how the actual ADODB.Connection.Errors collection should actually work.

My interpretation at the moment is that the connection will hold all the errors for the all the procedures that have been executed on that connection.

So I should be able to say

on error resume next 

... code goes here ... 2 or more command objects execute procedures against the database on the same connection

if con.Errors <> 0 then 

  loop through all the Errors objects (1 for each procedure that would've been executed on the connection)

end if 

However I have implemented that basic structure and I only get the one error description? So I am looking for someone to confirm that is the case. Does the Errors collection hold more than one error for more than one procedure? Or is if multiple errors occurred for one procedure?

I can't seem to find any documentation that would indicate exactly what would happen in this case.

Thanks,


回答1:


from Errors Collection (ADO) - MSDN:

Any operation involving ADO objects can generate one or more provider errors. As each error occurs, one or more Error objects can be placed in the Errors collection of the Connection object. When another ADO operation generates an error, the Errors collection is cleared, and the new set of Error objects can be placed in the Errors collection.

So, to catch all errors, seems to be need to check the collection after each possible error.



来源:https://stackoverflow.com/questions/8718189/how-does-the-classic-asp-connection-errors-collection-actually-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!