asp.net.ph

SqlConnection.PacketSize Property

System.Data.SqlClient Namespace   SqlConnection Class


Returns the size ( in bytes ) of network packets used to communicate with an instance of SQL Server.

Syntax


Script [ integer variable = ] SqlConnection.PacketSize

Property Value


variable Returns the size ( in bytes ) of network packets.

The property is read only with a default value of 8192.

Remarks

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.

Example

The following example shows the simplest way to retrieve and display the Packet Size property of the current connection.

"Packet Size: " + myConn.PacketSize;
  C# VB

 Show me 

See Also

SqlConnection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph