<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>实现数据 Try/Catch 块 </Title>
      <Author>Microsoft Corporation</Author>
      <Description>实现一个 Try/Catch 块，这个块用于处理异常、DataException 和从 DataException 派生的所有异常。</Description>
      <Shortcut>adoTryCatch</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Data.dll</Assembly>
        </Reference>
        <Reference>
          <Assembly>System.Xml.dll</Assembly>
        </Reference>
      </References>
      <Imports>
        <Import>
          <Namespace>System.Data</Namespace>
        </Import>
		  <Import>
			  <Namespace>System</Namespace>
		  </Import>
      </Imports>
      <Declarations>
        <Literal>
          <ID>tryCode</ID>
          <Type>String</Type>
          <ToolTip>替换为数据任务代码。</ToolTip>
          <Default>' Add your data task here. </Default>
        </Literal>
        <Literal>
          <ID>finallyCode</ID>
          <Type>String</Type>
          <ToolTip>释放在 Try 块中使用的所有资源。</ToolTip>
          <Default>' Dispose of any resources you used in the Try block.</Default>
        </Literal>
      </Declarations>
      <Code Language="VB" Kind="method body"><![CDATA[Try
    $tryCode$
Catch concurrencyEx As DBConcurrencyException
    Throw concurrencyEx 
Catch constraintEx As ConstraintException
    Throw constraintEx
Catch deletedRowEx As DeletedRowInaccessibleException
    Throw deletedRowEx
Catch duplicateNameEx As DuplicateNameException
    Throw duplicateNameEx
Catch inRowChangingEx As InRowChangingEventException
    Throw inRowChangingEx
Catch invalidConstraintEx As InvalidConstraintException
    Throw invalidConstraintEx
Catch invalidExpressionEx As InvalidExpressionException
    Throw invalidExpressionEx
Catch missingPrimaryEx As MissingPrimaryKeyException
    Throw missingPrimaryEx
Catch noNullEx As NoNullAllowedException
    Throw noNullEx
Catch readOnlyEx As ReadOnlyException
    Throw readOnlyEx
Catch rowNotInTableEx As RowNotInTableException
    Throw rowNotInTableEx
Catch strongTypingEx As StrongTypingException
    Throw strongTypingEx
Catch typedDataSetEx As TypedDataSetGeneratorException
    Throw typedDataSetEx
Catch versionNotFoundEx As VersionNotFoundException
    Throw versionNotFoundEx
Catch dataEx As DataException
    Throw dataEx
Catch ex As Exception
    Throw ex
Finally
    $finallyCode$
End Try
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
