共用方式為


DataFile.IsPrimaryFile 屬性

Gets the Boolean property value that specifies whether the data file is the primary file of the database.

命名空間:  Microsoft.SqlServer.Management.Smo
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.ReadOnlyAfterCreation Or SfcPropertyFlags.Standalone)> _
Public Property IsPrimaryFile As Boolean 
    Get 
    Set
'用途
Dim instance As DataFile 
Dim value As Boolean 

value = instance.IsPrimaryFile

instance.IsPrimaryFile = value
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.ReadOnlyAfterCreation|SfcPropertyFlags.Standalone)]
public bool IsPrimaryFile { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::ReadOnlyAfterCreation|SfcPropertyFlags::Standalone)]
public:
property bool IsPrimaryFile {
    bool get ();
    void set (bool value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.ReadOnlyAfterCreation|SfcPropertyFlags.Standalone)>]
member IsPrimaryFile : bool with get, set
function get IsPrimaryFile () : boolean 
function set IsPrimaryFile (value : boolean)

屬性值

型別:System.Boolean
A Boolean value that specifies whether the data file is the primary file or a secondary file.If True, the data file the primary file. Otherwise, False (default).

備註

The primary file has an .mdf file extension and secondary files have an .ndf file extension.

範例

使用檔案群組和檔案來儲存資料

請參閱

參考

DataFile 類別

Microsoft.SqlServer.Management.Smo 命名空間

其他資源

檔案與檔案群組架構

CREATE DATABASE (Transact-SQL)