Read this article in your language IT | EN | DE | ES
<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Create a Server based SQLConnection to SQL Server</Title>
<Author>Microsoft Corporation</Author>
<Description>Creates a SQL Connection providing replacements for the typical connection name/value pairs. For this code snippet to compile, add a reference to System.Data.dll and System.Xml.dll.</Description>
<Shortcut>adoCreateSqlConn</Shortcut>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>conn</ID>
<Type>SqlConnection</Type>
<ToolTip>Replace this with the name of the connection object.</ToolTip>
<Default>conn</Default>
</Literal>
<Literal>
<ID>serverName</ID>
<Type>String</Type>
<ToolTip>Replace this with the name of the server.</ToolTip>
<Default>ServerName</Default>
</Literal>
<Literal>
<ID>dataBaseName</ID>
<Type>String</Type>
<ToolTip>Replace this with the name of the database.</ToolTip>
<Default>Northwind</Default>
</Literal>
<Literal>
<ID>userId</ID>
<Type>String</Type>
<ToolTip>Replace this with the user name for connectivity to the database.</ToolTip>
<Default><user name></Default>
</Literal>
<Literal>
<ID>password</ID>
<Type>String</Type>
<ToolTip>Replace with the password that corresponds to your user name</ToolTip>
<Default><your password></Default>
</Literal>
<Literal Editable="false">
<ID>SqlConnectionClass</ID>
<Function>SimpleTypeName(System.Data.SqlClient.SqlConnection)</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[$SqlConnectionClass$ $conn$ = new $SqlConnectionClass$();
$conn$.ConnectionString = @"Data Source=$serverName$;Initial Catalog=$dataBaseName$;Persist Security Info=True;User ID=$userId$;Password=$password$";$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
bd1e2e33-b251-49be-bba0-9b9e361ca994|0|.0
C# , C# Görsel Ders Egitim
c#