You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/connect/ado-net/commands-parameters.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Commands and Parameters"
2
+
title: "Commands and parameters"
3
3
description: Learn how to use Command objects for Microsoft SqlClient Data Provider for SQL Server to run commands and return results from a data source.
4
4
ms.date: "11/25/2020"
5
5
ms.assetid: b623f810-d871-49a5-b0f5-078cc3c34db6
@@ -40,5 +40,6 @@ Describes how to use the Microsoft SqlClient data provider for SQL Server to exe
40
40
41
41
## See also
42
42
43
+
-[DataAdapters and DataReaders](dataadapters-datareaders.md)
43
44
-[Connecting to a data source](connecting-to-data-source.md)
44
45
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/configure-parameters.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Parameterized commands can also improve query execution performance, because the
25
25
26
26
A <xref:System.Data.Common.DbParameter> object can be created by using its constructor, or by adding it to the <xref:System.Data.Common.DbCommand.DbParameterCollection%2A> by calling the `Add` method of the <xref:System.Data.Common.DbParameterCollection> collection. The `Add` method will take as input either constructor arguments or an existing parameter object, depending on the data provider.
27
27
28
-
## Supplying the ParameterDirection property
28
+
## Supply the ParameterDirection property
29
29
30
30
When adding parameters, you must supply a <xref:System.Data.ParameterDirection> property for parameters other than input parameters. The following table shows the `ParameterDirection` values that you can use with the <xref:System.Data.ParameterDirection> enumeration.
31
31
@@ -36,12 +36,12 @@ When adding parameters, you must supply a <xref:System.Data.ParameterDirection>
36
36
|<xref:System.Data.ParameterDirection.Output>|The parameter is an output parameter.|
37
37
|<xref:System.Data.ParameterDirection.ReturnValue>|The parameter represents a return value from an operation such as a stored procedure, built-in function, or user-defined function.|
38
38
39
-
## Working with parameter placeholders
39
+
## Work with parameter placeholders
40
40
41
41
The syntax for parameter placeholders depends on the data source. The Microsoft SqlClient Data Provider for SQL Server handles naming and specifying parameters and parameter placeholders differently.
42
42
The SqlClient data provider uses named parameters in the format `@`*parametername*.
43
43
44
-
## Specifying parameter data types
44
+
## Specify parameter data types
45
45
46
46
The data type of a parameter is specific to the Microsoft SqlClient Data Provider for SQL Server. Specifying the type converts the value of the `Parameter` to the Microsoft SqlClient Data Provider for SQL Server type before passing the value to the data source. You may also specify the type of a `Parameter` in a generic manner by setting the `DbType` property of the `Parameter` object to a particular <xref:System.Data.DbType>.
47
47
@@ -84,7 +84,7 @@ The Microsoft SqlClient Data Provider for SQL Server type of a `Parameter` objec
84
84
> [!NOTE]
85
85
> When you send a null parameter value to the server, you must specify <xref:System.DBNull>, not `null` (`Nothing` in Visual Basic). The null value in the system is an empty object that has no value. <xref:System.DBNull> is used to represent null values.
86
86
87
-
## Deriving parameter information
87
+
## Derive parameter information
88
88
89
89
Parameters can also be derived from a stored procedure using the `DbCommandBuilder` class. The `SqlCommandBuilder` class provides a static method, `DeriveParameters`, which automatically populates the parameters collection of a command object that uses parameter information from a stored procedure. Note that `DeriveParameters` overwrites any existing parameter information for the command.
90
90
@@ -118,4 +118,6 @@ This example demonstrates how to call a SQL Server stored procedure in the `Nort
118
118
## See also
119
119
120
120
-[Commands and parameters](commands-parameters.md)
121
+
-[DataAdapters and DataReaders](dataadapters-datareaders.md)
121
122
-[Data type mappings in ADO.NET](data-type-mappings-ado-net.md)
123
+
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connecting-to-data-source.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ In the Microsoft SqlClient data provider, you use a **Connection** object to con
21
21
22
22
The Microsoft SqlClient Data Provider for SQL Server includes a <xref:Microsoft.Data.SqlClient.SqlConnection> type that is derived from a <xref:System.Data.Common.DbConnection> class.
23
23
24
-
## In This Section
24
+
## In this section
25
25
26
26
[Establishing the Connection](establishing-connection.md)\
27
27
Describes how to use a **Connection** object to establish a connection to a data source.
@@ -35,3 +35,5 @@ Describes how to use an **InfoMessage** event to retrieve informational messages
35
35
-[Connection pooling](connection-pooling.md)
36
36
-[Commands and parameters](commands-parameters.md)
37
37
-[DataAdapters and DataReaders](dataadapters-datareaders.md)
38
+
-[Transactions and concurrency](transactions-and-concurrency.md)
39
+
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connection-events.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ The Microsoft SqlClient Data Provider for SQL Server has **Connection** objects
26
26
|**InfoMessage**|Occurs when an informational message is returned from a data source. Informational messages are messages from a data source that do not result in an exception being thrown.|
27
27
|**StateChange**|Occurs when the state of the **Connection** changes.|
28
28
29
-
## Working with the InfoMessage Event
29
+
## Work with the InfoMessage event
30
30
31
31
You can retrieve warnings and informational messages from a SQL Server data source using the <xref:Microsoft.Data.SqlClient.SqlConnection.InfoMessage> event of the <xref:Microsoft.Data.SqlClient.SqlConnection> object. Errors returned from the data source with a severity level of 11 through 16 cause an exception to be thrown. However, the <xref:Microsoft.Data.SqlClient.SqlConnection.InfoMessage> event can be used to obtain messages from the data source that are not associated with an error. In the case of Microsoft SQL Server, any error with a severity of 10 or less is considered to be an informational message, and can be captured by using the <xref:Microsoft.Data.SqlClient.SqlConnection.InfoMessage> event. For more information, see the [Database Engine Error Severities](/sql/relational-databases/errors-events/database-engine-error-severities) article.
32
32
@@ -38,7 +38,7 @@ The following code example shows how to add an event handler for the <xref:Micro
The <xref:Microsoft.Data.SqlClient.SqlConnection.InfoMessage> event will normally fire only for informational and warning messages that are sent from the server. However, when an actual error occurs, the execution of the **ExecuteNonQuery** or **ExecuteReader** method that initiated the server operation is halted and an exception is thrown.
44
44
@@ -47,7 +47,7 @@ If you want to continue processing the rest of the statements in a command regar
47
47
> [!NOTE]
48
48
> An error with a severity level of 17 or above that causes the server to stop processing the command must be handled as an exception. In this case, an exception is thrown regardless of how the error is handled in the <xref:Microsoft.Data.SqlClient.SqlConnection.InfoMessage> event.
49
49
50
-
## Working with the StateChange Event
50
+
## Work with the StateChange event
51
51
52
52
The **StateChange** event occurs when the state of a **Connection** changes. The **StateChange** event receives <xref:System.Data.StateChangeEventArgs> that enable you to determine the change in state of the **Connection** by using the **OriginalState** and **CurrentState** properties. The **OriginalState** property is a <xref:System.Data.ConnectionState> enumeration that indicates the state of the **Connection** before it changed. **CurrentState** is a <xref:System.Data.ConnectionState> enumeration that indicates the state of the **Connection** after it changed.
53
53
@@ -58,3 +58,4 @@ The following code example uses the **StateChange** event to write a message to
58
58
## See also
59
59
60
60
-[Connecting to a data source](connecting-to-data-source.md)
61
+
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connection-pooling.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,12 @@ ms.reviewer: v-chmalh
19
19
20
20
Connecting to a data source can be time consuming. To minimize the cost of opening connections, ADO.NET uses an optimization technique called *connection pooling*, which minimizes the cost of repeatedly opening and closing connections.
21
21
22
-
## In This Section
22
+
## In this section
23
23
24
24
[SQL Server Connection Pooling (ADO.NET)](sql-server-connection-pooling.md)
25
25
Provides an overview of connection pooling and describes how connection pooling works in SQL Server.
26
26
27
27
## See also
28
28
29
-
-[Retrieving and Modifying Data in ADO.NET](retrieving-modifying-data.md)
29
+
-[Retrieving and modifying data in ADO.NET](retrieving-modifying-data.md)
30
30
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connection-string-builders.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ ms.reviewer: v-chmalh
21
21
22
22
In earlier versions of ADO.NET, compile-time checking of connection strings with concatenated string values did not occur, so that at run time, an incorrect keyword generated an <xref:System.ArgumentException>. The Microsoft SqlClient Data Provider for SQL Server includes the strongly typed connection string builder class <xref:Microsoft.Data.SqlClient.SqlConnectionStringBuilder?displayProperty=nameWithType> that inherits from <xref:System.Data.Common.DbConnectionStringBuilder>.
23
23
24
-
## Connection String Injection Attacks
24
+
## Connection string injection attacks
25
25
26
26
A connection string injection attack can occur when dynamic string concatenation is used to build connection strings that are based on user input. If the string is not validated and malicious text or characters not escaped, an attacker can potentially access sensitive data or other resources on the server. For example, an attacker could mount an attack by supplying a semicolon and appending an additional value. The connection string is parsed by using a "**last one wins**" algorithm, and the hostile input is substituted for a legitimate value.
27
27
@@ -38,7 +38,7 @@ data source=(local);Integrated Security=True;
38
38
initial catalog="AdventureWorks;NewValue=Bad"
39
39
```
40
40
41
-
## Building Connection Strings from Configuration Files
41
+
## Build connection strings from configuration files
42
42
43
43
If certain elements of a connection string are known beforehand, they can be stored in a configuration file and retrieved at run time to construct a complete connection string. For example, the name of the database might be known in advance, but not the name of the server. Or you might want a user to supply a name and password at run time without being able to inject other values into the connection string.
44
44
@@ -68,3 +68,4 @@ This example demonstrates retrieving a partial connection string from a configur
68
68
## See also
69
69
70
70
-[Connection strings](connection-strings.md)
71
+
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connection-string-syntax.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,23 +19,23 @@ ms.reviewer: v-chmalh
19
19
20
20
The <xref:Microsoft.Data.SqlClient> has a `Connection` object that inherits from <xref:System.Data.Common.DbConnection> as well as a provider-specific <xref:System.Data.Common.DbConnection.ConnectionString%2A> property. The specific connection string syntax for the SqlClient provider is documented in its `ConnectionString` property. For more information on connection string syntax, see <xref:Microsoft.Data.SqlClient.SqlConnection.ConnectionString%2A>.
21
21
22
-
## Connection String Builders
22
+
## Connection string builders
23
23
24
24
Microsoft SqlClient Data Provider for SQL Server introduced the following connection string builder.
The connection string builders allow you to construct syntactically valid connection strings at run time, so you do not have to manually concatenate connection string values in your code. For more information, see [Connection String Builders](connection-string-builders.md).
29
29
30
-
## Windows Authentication
30
+
## Windows authentication
31
31
32
32
We recommend using Windows Authentication (sometimes referred to as *integrated security*) to connect to data sources that support it. The following table shows the Windows Authentication syntax used with the Microsoft SqlClient Data Provider for SQL Server.
The syntax for a <xref:Microsoft.Data.SqlClient.SqlConnection> connection string is documented in the <xref:Microsoft.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> property. You can use the <xref:Microsoft.Data.SqlClient.SqlConnection.ConnectionString%2A> property to get or set a connection string for a SQL Server database. The connection string keywords also map to properties in the <xref:Microsoft.Data.SqlClient.SqlConnectionStringBuilder>.
41
41
@@ -78,17 +78,17 @@ To connect to a named instance of SQL Server, use the *server name\instance name
78
78
79
79
You can also set the <xref:Microsoft.Data.SqlClient.SqlConnectionStringBuilder.DataSource%2A> property of the `SqlConnectionStringBuilder` to the instance name when building a connection string. The <xref:Microsoft.Data.SqlClient.SqlConnection.DataSource%2A> property of a <xref:Microsoft.Data.SqlClient.SqlConnection> object is read-only.
80
80
81
-
### Type System Version Changes
81
+
### Type system version changes
82
82
83
83
The `Type System Version` keyword in a <xref:Microsoft.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> specifies the client-side representation of SQL Server types. See <xref:Microsoft.Data.SqlClient.SqlConnection.ConnectionString%2A?displayProperty=nameWithType> for more information about the `Type System Version` keyword.
84
84
85
-
## Connecting and Attaching to SQL Server Express User Instances
85
+
## Connect and Attach to SQL Server Express user instances
86
86
87
87
User instances are a feature in SQL Server Express. They allow a user running on a least-privileged local Windows account to attach and run a SQL Server database without requiring administrative privileges. A user instance executes with the user's Windows credentials, not as a service.
88
88
89
89
For more information on working with user instances, see [SQL Server Express User Instances](./sql/sql-server-express-user-instances.md).
90
90
91
-
## Using TrustServerCertificate
91
+
## Use TrustServerCertificate
92
92
93
93
The `TrustServerCertificate` keyword is valid only when connecting to a SQL Server instance with a valid certificate. When `TrustServerCertificate` is set to `true`, the transport layer will use TLS/SSL to encrypt the channel and bypass walking the certificate chain to validate trust.
94
94
@@ -99,7 +99,7 @@ The `TrustServerCertificate` keyword is valid only when connecting to a SQL Serv
99
99
> [!NOTE]
100
100
> If `TrustServerCertificate` is set to `true` and encryption is turned on, the encryption level specified on the server will be used even if `Encrypt` is set to `false` in the connection string. The connection will fail otherwise.
101
101
102
-
### Enabling Encryption
102
+
### Enable encryption
103
103
104
104
To enable encryption when a certificate has not been provisioned on the server, the **Force Protocol Encryption** and the **Trust Server Certificate** options must be set in SQL Server Configuration Manager. In this case, encryption will use a self-signed server certificate without validation if no verifiable certificate has been provisioned on the server.
105
105
@@ -123,3 +123,4 @@ For more information, see [Using Encryption Without Validation](/sql/relational-
123
123
124
124
-[Connection strings](connection-strings.md)
125
125
-[Connecting to a data source](connecting-to-data-source.md)
126
+
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
0 commit comments