Application.RenameFolderOnSqlServer Method
指定した SQL Server のインスタンスでフォルダの名前を変更します。
名前空間: Microsoft.SqlServer.Dts.Runtime
アセンブリ: Microsoft.SqlServer.ManagedDTS (microsoft.sqlserver.manageddts.dll 内)
構文
'宣言
Public Sub RenameFolderOnSqlServer ( _
strParent As String, _
strOldName As String, _
strNewName As String, _
strServerName As String, _
strServerUserName As String, _
strServerPassword As String _
)
public void RenameFolderOnSqlServer (
string strParent,
string strOldName,
string strNewName,
string strServerName,
string strServerUserName,
string strServerPassword
)
public:
void RenameFolderOnSqlServer (
String^ strParent,
String^ strOldName,
String^ strNewName,
String^ strServerName,
String^ strServerUserName,
String^ strServerPassword
)
public void RenameFolderOnSqlServer (
String strParent,
String strOldName,
String strNewName,
String strServerName,
String strServerUserName,
String strServerPassword
)
public function RenameFolderOnSqlServer (
strParent : String,
strOldName : String,
strNewName : String,
strServerName : String,
strServerUserName : String,
strServerPassword : String
)
パラメータ
- strParent
親フォルダの名前です。
- strOldName
既存フォルダの名前です。
- strNewName
フォルダの新しい名前です。
- strServerName
SQL Server のインスタンスの名前です。
- strServerUserName
サーバーで認証するときに使用するユーザー名です。
- strServerPassword
strServerUserName アカウントに関連付けられているパスワードです。
使用例
次のコード例では、SQL Server にフォルダを作成し、名前を変更してから削除します。
[C#]
static void Main(string[] args)
{
// The variable pkg points to the location
// of the ExecuteProcess package sample
// that is installed with the SSIS samples.
string pkg = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";
Application app = new Application();
app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", null, null);
// Verify that the folder was created.
Boolean ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", null, null);
Console.WriteLine("myNewFolderExists? " + ssFolder);
// Rename the myNewFolder to myRenamedFolder.
app.RenameFolderOnSqlServer("\\", "myNewFolder", "myRenamedFolder", "yourserver", null, null);
// Verify that the old folder does not exist.
ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", null, null);
Console.WriteLine("myNewFolderExists has been renamed but still exists? " + ssFolder);
// Verify that a folder with the new name does exist.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", null, null);
Console.WriteLine("myRenamedFolder now exists? " + ssFolder);
// Delete the new folder.
app.RemoveFolderFromSqlServer("\\myRenamedFolder", "yourserver", null, null);
// Verify that the folder was removed.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", null, null);
Console.WriteLine("myRenamedFolder still exists? " + ssFolder);
}
Shared Sub Main(ByVal args() As String)
' The variable pkg points to the location
' of the ExecuteProcess package sample
' that is installed with the SSIS samples.
Dim pkg As String = "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"
Dim app As Application = New Application()
app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", Nothing, Nothing)
' Verify that the folder was created.
Dim ssFolder As Boolean = app.FolderExistsOnSqlServer("\\myNewFolder","yourserver",Nothing,Nothing)
Console.WriteLine("myNewFolderExists? " + ssFolder)
' Rename the myNewFolder to myRenamedFolder.
app.RenameFolderOnSqlServer("\\", "myNewFolder", "myRenamedFolder", "yourserver", Nothing, Nothing)
' Verify that the old folder does not exist.
ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", Nothing, Nothing)
Console.WriteLine("myNewFolderExists has been renamed but still exists? " + ssFolder)
' Verify that a folder with the new name does exist.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)
Console.WriteLine("myRenamedFolder now exists? " + ssFolder)
' Delete the new folder.
app.RemoveFolderFromSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)
' Verify that the folder was removed.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)
Console.WriteLine("myRenamedFolder still exists? " + ssFolder)
End Sub
サンプルの出力 :
myNewFolderExists?True
myNewFolderExists has been renamed but still exists?False
myRenamedFolder now exists?True
myRenamedFolder still exists?False
スレッド セーフ
この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
Application Class
Application Members
Microsoft.SqlServer.Dts.Runtime Namespace