Under the namespace System.Data.SqlClient
, we have both SqlDataReader.GetSqlBinary
and SqlDataReader.GetSqlBytes.
Both seems to give "raw data". If so, what's the difference between them?
Under the namespace System.Data.SqlClient
, we have both SqlDataReader.GetSqlBinary
and SqlDataReader.GetSqlBytes.
Both seems to give "raw data". If so, what's the difference between them?
The GetSQLBytes are stored in an inside buffer for more manipulation, the Binary are just a stream that you get and use it as it is.
This two return SqlBytes and SqlBinary and by see this two types you can see the full different of them and how they store the data.
http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.storage.aspx
http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.aspx
GetSqlBinary
returns an SqlBinary
structure:
Represents a variable-length stream of binary data to be stored in or retrieved from a database.
GetSqlBytes
returns an SqlBytes
class:
Represents a mutable reference type that wraps either a Buffer or a Stream.
So is seems that the difference is that GetSqlBinary
gives you a lump of data as a byte array, while GetSqlBytes
is similar but stores the data in a buffer which allows you to interact with the underlying data as a stream.
The GetSQLBytes are stored in an inside buffer for more manipulation, the Binary are just a stream that you get and use it as it is.
This two return SqlBytes and SqlBinary and by see this two types you can see the full different of them and how they store the data.
http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.storage.aspx
http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.aspx
© 2022 - 2024 — McMap. All rights reserved.