SqlFileStream Constructor (String, Byte, FileAccess, FileOptions, Int64)
Initializes a new instance of the SqlFileStream class.
Assembly: System.Data (in System.Data.dll)
new : path:string * transactionContext:byte * access:FileAccess * options:FileOptions * allocationSize:int64 -> SqlFileStream
- Type: System.String
The logical path to the file. The path can be retrieved by using the Transact-SQL Pathname function on the underlying FILESTREAM column in the table.
- Type: System.Byte
The transaction context for the SqlFileStream object. When set to null, an implicit transaction will be used for the SqlFileStream object. Applications should return the byte array returned by calling the GET_FILESTREAM_TRANSACTION_CONTEXT method.
- Type: System.IO.FileAccess
When using FileAccess.Read, the SqlFileStream object can be used to read all of the existing data.
When using FileAccess.Write, SqlFileStream points to a zero byte file. Existing data will be overwritten when the object is closed and the transaction is committed.
When using FileAccess.ReadWrite, the SqlFileStream points to a file which has all the existing data in it. The handle is positioned at the beginning of the file. You can use one of the System.IO Seek methods to move the handle position within the file to write or append new data.
- Type: System.IO.FileOptions
- Type: System.Int64
The allocation size to use while creating a file. If set to 0, the default value is used.
path is a null reference, or transactionContext is null.
path is an empty string (""), contains only white space, or contains one or more invalid characters.
path begins with "\\.\", for example "\\.\PHYSICALDRIVE0 ".
The handle returned by call to NTCreateFile is not of type FILE_TYPE_DISK.
options contains an unsupported value.
The file cannot be found.
An I/O error occurred.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
The access requested is not permitted by the operating system for the specified path. This occurs when Write or ReadWrite access is specified, and the file or directory is set for read-only access.
NtCreateFile fails with error code set to ERROR_SHARING_VIOLATION.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.