Export (0) Print
Expand All

FileGroup Constructor (Database, String, Boolean)

Initializes a new instance of the FileGroup class on the specified database with the specified name. Optionally, enables a FILESTREAM file group to be created.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

public FileGroup(
	Database database,
	string name,
	bool isFileStream
)

Parameters

database
Type: Microsoft.SqlServer.Management.Smo.Database
A Database object value that represents the database that stores files in the file group.
name
Type: String
A String value that represents the name of the file group.
isFileStream
Type: Boolean
A Boolean value. If (true) the instance will be initialized so that file groups of FILESTREAM type can be created.

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();
        }
    }
}
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft