System.Data.SqlClient Namespace SqlConnection Class
Returns the size ( in bytes ) of network packets used to communicate with an instance of SQL Server.
Script |
[ integer variable = ] SqlConnection.PacketSize |
variable |
Returns the size ( in bytes ) of network packets. |
The property is read only with a default value of 8192.
If an application performs bulk copy operations, or sends or receives large amounts of text or image data, a packet size larger than the default may improve efficiency because it results in fewer network read and write operations. If an application sends and receives small amounts of information, you can set the packet size to 512 bytes ( using the Packet Size value in the ConnectionString ), which is sufficient for most data transfer operations. For most applications, the default packet size is best.
PacketSize may be a value in the range of 512 and 32767 bytes. An exception is generated if the value is outside of this range.
The following example shows the simplest way to retrieve and display the Packet Size property of the current connection.
"Packet Size: " + myConn.PacketSize;
"Packet Size: " + myConn.PacketSize |
|
C# |
VB |
Show me
SqlConnection Members