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_CreateSqlExpressConnection_snippet_142631_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  52 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 local SQLConnection to SQL Express</Title>
  6.       <Author>Microsoft</Author>
  7.       <Description>Creates a SQL Connection providing replacements for the typical connection name/value pairs for a SQL Express Connection using User Instance=True</Description>
  8.       <Shortcut>adoCreateSqlExpConn</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.Data.SqlClient</Namespace>
  25.         </Import>
  26.       </Imports>
  27.       <Declarations>
  28.         <Literal>
  29.           <ID>dataBaseName</ID>
  30.           <Type>String</Type>
  31.           <ToolTip>Replace this with the file name of the database.</ToolTip>
  32.           <Default>Northwind</Default>
  33.         </Literal>
  34.         <Literal>
  35.           <ID>dataDirectory</ID>
  36.           <Type>String</Type>
  37.           <ToolTip>To use the DataDirectory created as part of Click Once, use the |DataDirectory| macro.  Replace this macro if you wish to use a specific directory</ToolTip>
  38.           <Default>|DataDirectory|</Default>
  39.         </Literal>
  40.         <Object>
  41.           <ID>conn</ID>
  42.           <Type>SqlConnection</Type>
  43.           <ToolTip>Replace this with the name of the connection object.</ToolTip>
  44.           <Default>conn</Default>
  45.         </Object>
  46.       </Declarations>
  47.       <Code Language="VB" Kind="method body"><![CDATA[Dim $conn$ As New SqlConnection()
  48. $conn$.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=$dataDirectory$\$dataBaseName$.mdf;Integrated Security=True;User Instance=True"
  49. ]]></Code>
  50.     </Snippet>
  51.   </CodeSnippet>
  52. </CodeSnippets>