FileGroup 构造函数 (Database, String, Boolean)
在指定的数据库上使用指定名称初始化 FileGroup 类的新实例。(可选)支持创建一个 FILESTREAM 文件组。
命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)
语法
声明
Public Sub New ( _
database As Database, _
name As String, _
isFileStream As Boolean _
)
用法
Dim database As Database
Dim name As String
Dim isFileStream As Boolean
Dim instance As New FileGroup(database, _
name, isFileStream)
public FileGroup(
Database database,
string name,
bool isFileStream
)
public:
FileGroup(
Database^ database,
String^ name,
bool isFileStream
)
new :
database:Database *
name:string *
isFileStream:bool -> FileGroup
public function FileGroup(
database : Database,
name : String,
isFileStream : boolean
)
参数
- database
类型:Microsoft.SqlServer.Management.Smo. . :: . .Database
一个 Database 对象值,该值表示在文件组中存储文件的数据库。
- name
类型:System. . :: . .String
一个 String 值,该值表示文件组的名称。
- isFileStream
类型:System. . :: . .Boolean
一个 Boolean 值。如果为 (true),则将初始化实例,以便可以创建 FILESTREAM 类型的文件组。
示例
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Management.Smo
Module Module1
Sub Main()
'Connect to the local, default instance of SQL Server.
Dim svr As New Server()
'Define a Database object instance by supplying the server
'and the database name arguments in the constructor.
Dim db As New Database(svr, "MyPhotos")
'Create the database on the instance of SQL Server.
db.Create()
'Define a FileGroup object instance for creation of FILESTREAM
'groups by supplying the database, group name, and supplying
'true for the isFileStream parameters.
Dim myFileGroup As New FileGroup(db, "MyPhotoGroup", True)
If myFileGroup.IsFileStream = True Then
Console.WriteLine("MyPhotoGroup is enabled for the creation of a FILESTREAM file group.")
End If
'Remove the database to clean up.
db.Drop()
End Sub
End Module
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Connect to the local, default instance of SQL Server.
Server svr = new Server();
//Define a Database object instance by supplying the server
//and the database name arguments in the constructor.
Database db = new Database(svr, "MyPhotos");
//Create the database on the instance of SQL Server.
db.Create();
//Define a FileGroup object instance for creation of FILESTREAM
//groups by supplying the database, group name, and supplying
//true for the isFileStream parameters.
FileGroup myFileGroup = new FileGroup(db, "MyPhotoGroup", true);
if (myFileGroup.IsFileStream == true)
Console.WriteLine("MyPhotoGroup is enabled for the creation of a FILESTREAM file group.");
//Remove the database to clean up.
db.Drop();
}
}
}