如题,在VB6.0中应该怎样使用ADO Errors collection?请尽量用代码说明。
不胜感激!
不胜感激!
解决方案 »
- vb form的问题
- rst.delete
- 急啊,在vb的自带的报表设计器中做成的报表,它自身的报表输出成txt文件的操作(指左上角的输出按钮能完成的报表输出功能),怎么在代码
- 急!非常奇怪:自定义类的方法不能用
- picture 的2个问题,高分相送,解决就结帐
- 请教各位高手:有关MSHF...的使用.
- 菜鸟问题, 高分救教高手. 请问 MSFlexGrid 控件如何使用?
- VC函数转换成VB函数
- 急:找不到指定模块form2.0 object library library
- Winsock.SendData发字节数组,如何不发末尾的0?
- 禁止VSFLEXGRID滚动条自动滚动
- VB安装后打不开,提示 Unexpected error: quitting
Dim cn As ADODB.Connection
Dim adErr As ADODB.Error
On Error GoTo ErrHandler Set cn = New ADODB.Connection
cn.Open ...
cn.Execute "SELECT"ExitEntry:
Exit Sub
ErrHandler:
Debug.Print "VB Err: ", Err.Number, Err.Description Debug.Print "ADO Error:"
For Each adErr In cn.Errors
Debug.Print adErr.Number, adErr.Description
Next
Resume ExitEntry
End Sub
In addition to the provider errors that are described in the Error object and Errors collection, ADO itself can return errors to the exception-handling mechanism of your run-time environment. Use your programming language's error trapping mechanism, such as the On Error statement in Microsoft® Visual Basic®, to trap and handle the following errors. Both decimal and hexadecimal error code values are shown. Constant Name Number Description
adErrInvalidArgument 3001
0x800A0BB9
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
adErrNoCurrentRecord 3021
0x800A0BCD
Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.
adErrIllegalOperation 3219
0x800A0C93
The operation requested by the application is not allowed in this context.
adErrInTransaction 3246
0x800A0CAE
The application may not explicitly close a Connection object while in the middle of a transaction.
adErrFeatureNotAvailable 3251
0x800A0CB3
The operation requested by the application is not supported by the provider.
adErrItemNotFound 3265
0x800A0CC1
ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application.
adErrObjectInCollection 3367
0x800A0D27
Can't append. Object already in collection.
adErrObjectNotSet 3420
0x800A0D5C
The object referenced by the application no longer points to a valid object.
adErrDataConversion 3421
0x800A0D5D
The application is using a value of the wrong type for the current operation.
adErrObjectClosed 3704
0x800A0E78
The operation requested by the application is not allowed if the object is closed.
adErrObjectOpen 3705
0x800A0E79
The operation requested by the application is not allowed if the object is open.
adErrProviderNotFound 3706
0x800A0E7A
ADO could not find the specified provider.
adErrBoundToCommand 3707
0x800A0E7B
The application cannot change the ActiveConnection property of a Recordset object with a Command object as its source.
adErrInvalidParamInfo 3708
0x800A0E7C
The application has improperly defined a Parameter object.
adErrInvalidConnection 3709
0x800A0E7D
The application requested an operation on an object with a reference to a closed or invalid Connection object