Hi guys,
I'm having problems with this error
'filename' is ambiguous in the namespace 'Microsoft.SqlServer.Management.Smo'
Here's the code:
I already imported the sqlserver references but it still don't work.
Thanks for the help.
I'm having problems with this error
'filename' is ambiguous in the namespace 'Microsoft.SqlServer.Management.Smo'
Here's the code:
Private Sub cmdBkup_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmdBkup.Click 'Dim sqlServer As New SQLServer Dim cdDrives As IO.DriveInfo() = IO.DriveInfo.GetDrives Dim dirPath As String Dim directoryFile As String Dim connectionString As String = "Data Source=" & gSqlSvrEnv.SERVER & ";Initial Catalog=" & gSqlSvrEnv.DATABASE & ";Integrated Security = true;" Try 'マウスカーソル待機状態 Cursor.Current = Cursors.WaitCursor 'ボタン無効化 cmdBkup.Enabled = False If getSchemaName(connectionString) = "comicbuster" Then Call changeSchema(connectionString) End If ' コントロールの初期化 lblCpForm.Text = "バックアップ中..." lblCpForm.Refresh() ProgressBar1.Value = 0 '管理者でSQLServerに接続 sqlServer = New Server(gSqlSvrEnv.SERVER) sqlServer.ConnectionContext.Connect() 'POSデータベースをバックアップ 'Me.lblCpBackupFile.Text = System.IO.Path.Combine(gSystemEnv.DB_BACKUP_PATH, _ ' "pos_db_" & DateTime.Now.ToString("yyyyMMdd") & ".dmp") Me.lblCpBackupFile.Text = System.IO.Path.Combine(gSystemEnv.DB_BACKUP_PATH, _ "pos_db.dmp") sqlBackup = New Backup With sqlBackup '.Action = SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database .Action = BackupActionType.Database .Database = gSqlSvrEnv.DATABASE .BackupSetName = "pos-Full Database Backup" 'Dim backupDevice As BackupDeviceItem = New BackupDeviceItem(lblCpBackupFile.Text, DeviceType.File) '.Files = "[" & Me.lblCpBackupFile.Text & "]" .Devices.AddDevice(lblCpBackupFile.Text, DeviceType.File) .SqlBackup(sqlServer) End With Call Zip(lblCpBackupFile.Text) Catch ex As Exception Call fncErrMsg(MOD_ID & ":" & "cmdBkup_Click()", ex.Message) Finally 'Call fncDBCloseAdmin(sqlServer) sqlServer.ConnectionContext.Disconnect() sqlServer = Nothing 'ボタン表示切替 cmdBkup.Visible = False cmdClose.Visible = True Me.ActiveControl = Me.cmdClose Call cmdClose.PerformClick() End Try End Sub '=================================================================== ' 処理概要 :バックアップ処理状況表示処理 ' パラメータ :規定 ' 戻り値 :なし '=================================================================== Private Sub sqlBackup_PercentComplete(ByVal sender As Object, ByVal e As Microsoft.SqlServer.Management.Smo.PercentCompleteEventArgs) Handles sqlBackup.PercentComplete Try ' 処理経過を表示 percent = percent + sqlBackup.PercentCompleteNotification ProgressBar1.Value = percent If percent = 100 Then ' 終了メッセージを表示 lblCpForm.Text = "バックアップ完了" System.Threading.Thread.Sleep(1000) Else System.Threading.Thread.Sleep(100) End If System.Windows.Forms.Application.DoEvents() 'マウスカーソル待機状態 Cursor.Current = Cursors.WaitCursor Catch ex As Exception Call fncErrMsg(MOD_ID & ":" & "sqlDmoBackup_PercentComplete()", ex.Message) Finally End Try End Sub
I already imported the sqlserver references but it still don't work.
Thanks for the help.