home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_ImplementDataTryCatchBlocks_snippet_142634_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  3KB  |  81 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Implement Data Try/Catch Blocks </Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Implements a Try/Catch block that handles Exception, DataException, and all the exceptions that derive from DataException.</Description>
  8.       <Shortcut>adoTryCatch</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Data.dll</Assembly>
  14.         </Reference>
  15.         <Reference>
  16.           <Assembly>System.Xml.dll</Assembly>
  17.         </Reference>
  18.       </References>
  19.       <Imports>
  20.         <Import>
  21.           <Namespace>System.Data</Namespace>
  22.         </Import>
  23.           <Import>
  24.               <Namespace>System</Namespace>
  25.           </Import>
  26.       </Imports>
  27.       <Declarations>
  28.         <Literal>
  29.           <ID>tryCode</ID>
  30.           <Type>String</Type>
  31.           <ToolTip>Replace with data task code.</ToolTip>
  32.           <Default>' Add your data task here. </Default>
  33.         </Literal>
  34.         <Literal>
  35.           <ID>finallyCode</ID>
  36.           <Type>String</Type>
  37.           <ToolTip>Dispose of any resources you used in the Try block.</ToolTip>
  38.           <Default>' Dispose of any resources you used in the Try block.</Default>
  39.         </Literal>
  40.       </Declarations>
  41.       <Code Language="VB" Kind="method body"><![CDATA[Try
  42.     $tryCode$
  43. Catch concurrencyEx As DBConcurrencyException
  44.     Throw concurrencyEx 
  45. Catch constraintEx As ConstraintException
  46.     Throw constraintEx
  47. Catch deletedRowEx As DeletedRowInaccessibleException
  48.     Throw deletedRowEx
  49. Catch duplicateNameEx As DuplicateNameException
  50.     Throw duplicateNameEx
  51. Catch inRowChangingEx As InRowChangingEventException
  52.     Throw inRowChangingEx
  53. Catch invalidConstraintEx As InvalidConstraintException
  54.     Throw invalidConstraintEx
  55. Catch invalidExpressionEx As InvalidExpressionException
  56.     Throw invalidExpressionEx
  57. Catch missingPrimaryEx As MissingPrimaryKeyException
  58.     Throw missingPrimaryEx
  59. Catch noNullEx As NoNullAllowedException
  60.     Throw noNullEx
  61. Catch readOnlyEx As ReadOnlyException
  62.     Throw readOnlyEx
  63. Catch rowNotInTableEx As RowNotInTableException
  64.     Throw rowNotInTableEx
  65. Catch strongTypingEx As StrongTypingException
  66.     Throw strongTypingEx
  67. Catch typedDataSetEx As TypedDataSetGeneratorException
  68.     Throw typedDataSetEx
  69. Catch versionNotFoundEx As VersionNotFoundException
  70.     Throw versionNotFoundEx
  71. Catch dataEx As DataException
  72.     Throw dataEx
  73. Catch ex As Exception
  74.     Throw ex
  75. Finally
  76.     $finallyCode$
  77. End Try
  78. ]]></Code>
  79.     </Snippet>
  80.   </CodeSnippet>
  81. </CodeSnippets>