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_CreateaDataRelation_snippet_142627_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  58 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>Create a DataRelation</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Creates a data relation between two data tables in a dataset.</Description>
  8.       <Shortcut>adoAddRelation</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Xml.dll</Assembly>
  14.         </Reference>
  15.         <Reference>
  16.           <Assembly>System.Data.dll</Assembly>
  17.         </Reference>
  18.       </References>
  19.       <Imports>
  20.         <Import>
  21.           <Namespace>System.Data</Namespace>
  22.         </Import>
  23.       </Imports>
  24.       <Declarations>
  25.         <Literal>
  26.           <ID>RelationName</ID>
  27.           <Type>String</Type>
  28.           <ToolTip>Replace with the name of the relation.</ToolTip>
  29.           <Default>"CustomersOrders"</Default>
  30.         </Literal>
  31.         <Literal>
  32.           <ID>ColumnName</ID>
  33.           <Type>String</Type>
  34.           <ToolTip>Replace with the column name.</ToolTip>
  35.           <Default>"CustomerID"</Default>
  36.         </Literal>
  37.         <Object>
  38.           <ID>DataSet</ID>
  39.           <Type>System.Data.DataSet</Type>
  40.           <ToolTip>Replace with a DataSet object.</ToolTip>
  41.           <Default>ds</Default>
  42.         </Object>
  43.         <Object>
  44.           <ID>relationObjectName</ID>
  45.           <Type>System.Data.DataRelation</Type>
  46.           <ToolTip>The object name for the relation</ToolTip>
  47.           <Default>customersOrdersRelation</Default>
  48.         </Object>
  49.       </Declarations>
  50.       <Code Language="VB" Kind="method body"><![CDATA[Dim $relationObjectName$ As New DataRelation($RelationName$, _
  51.         $DataSet$.Customers.Columns($ColumnName$), _
  52.         $DataSet$.Orders.Columns($ColumnName$))
  53.  
  54. $DataSet$.Relations.Add($relationObjectName$)
  55. ]]></Code>
  56.     </Snippet>
  57.   </CodeSnippet>
  58. </CodeSnippets>