OleDbErrorCollection.Count 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取集合中错误的数目。
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
属性值
集合中错误的总数。
实现
示例
以下示例显示 OleDbError 集合中的每个 OleDbErrorCollection 。
public void DisplayOleDbErrorCollection(OleDbException exception)
{
for (int i=0; i < exception.Errors.Count; i++)
{
MessageBox.Show("Index #" + i + "\n" +
"Message: " + exception.Errors[i].Message + "\n" +
"Native: " + exception.Errors[i].NativeError.ToString() + "\n" +
"Source: " + exception.Errors[i].Source + "\n" +
"SQL: " + exception.Errors[i].SQLState + "\n");
}
}
Public Sub DisplayOleDbErrorCollection(exception As OleDbException)
Dim i As Integer
For i = 0 To exception.Errors.Count - 1
MessageBox.Show("Index #" + i.ToString() + ControlChars.Cr _
+ "Message: " + exception.Errors(i).Message + ControlChars.Cr _
+ "Native: " + exception.Errors(i).NativeError.ToString() + ControlChars.Cr _
+ "Source: " + exception.Errors(i).Source + ControlChars.Cr _
+ "SQL: " + exception.Errors(i).SQLState + ControlChars.Cr)
Next i
End Sub