Using Streams as Input to Long Data Parameters
- Last Updated: April 16, 2026
- 1 minute read
- ADO.NET
- Documentation
Allowing the use of non contiguous memory to represent a very large binary or text value improves performance, functionality, and scalability. Stream objects are useful when processing a video clip, a large text, or, for the DB2 and Oracle data providers, an XML document. See Returning and Inserting/Updating XML Data in DB2 and Returning and Inserting/Updating XML Data in Oracle for more information.
Stream objects used to read binary data are derived from the System.IO.Stream object and use the Framework data type of byte[]:
- System.IO.BufferedStream
- System.IO.FileStream
- System.IO.MemoryStream
- System.Net.Sockets.NetworkStream
- System.Security.Cryptography.CryptoStream
Stream objects used to read text data are derived from the System.IO.TextReader object and use the Framework data type of string:
- System.IO.StreamReader
- System.IO.StringReader
To enable the use of streams, you set the Value property of the data provider’s Parameter object to a specific instance of the stream (see .NET Classes). When the command is executed, the data provider reads from the stream to extract the value.