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_ReadAccessDataintoaDataset_snippet_142635_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  55 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>Read Access Data into a Dataset</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Loads the data from one table in an Access database into a DataSet object.</Description>
  8.       <Shortcut>adoAccess</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</Namespace>
  22.         </Import>
  23.         <Import>
  24.           <Namespace>System.Data</Namespace>
  25.         </Import>
  26.         <Import>
  27.           <Namespace>System.Data.OleDb</Namespace>
  28.         </Import>
  29.         <Import>
  30.           <Namespace>Microsoft.VisualBasic</Namespace>
  31.         </Import>
  32.       </Imports>
  33.       <Declarations>
  34.         <Literal>
  35.           <ID>SQLString</ID>
  36.           <Type>String</Type>
  37.           <ToolTip>Replace with a SQL statement to retrieve the table.</ToolTip>
  38.           <Default>"Select * from Topics"</Default>
  39.         </Literal>
  40.         <Literal>
  41.           <ID>AccessFileName</ID>
  42.           <Type>String</Type>
  43.           <ToolTip>The file path to the Access file to be loaded</ToolTip>
  44.           <Default>AccessFile.mdb</Default>
  45.         </Literal>
  46.       </Declarations>
  47.       <Code Language="VB" Kind="method body"><![CDATA[Dim conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$AccessFileName$;Persist Security Info=False"
  48. Dim cmd As String = $SQLString$
  49. Dim adapter As New OleDbDataAdapter(cmd, conn)
  50. Dim topics As New DataSet
  51. adapter.Fill(topics)
  52. ]]></Code>
  53.     </Snippet>
  54.   </CodeSnippet>
  55. </CodeSnippets>