コード例 #1
0
ファイル: VerifyBackup.cs プロジェクト: ramnaresh/SMO
        /// <summary>
        /// Get information for the selected backup device.
        /// </summary>
        /// <param name="BackupDeviceName"></param>
        private void GetBackupDeviceInfo(string BackupDeviceName)
        {
            BackupDevice bkupDevice;

            // Get the appropriate BackupDevice object from the BackupDevices
            // collection of a connected SQLServer object.
            BackupDeviceList = SqlServerSelection.BackupDevices;

            // Get selected device
            bkupDevice = BackupDeviceList[BackupDeviceName];

            DeviceTypeLabel.Text = bkupDevice.BackupDeviceType.ToString();
            StatusLabel.Text     = bkupDevice.State.ToString();
            LocationLabel.Text   = bkupDevice.PhysicalLocation;
        }
コード例 #2
0
        public string[] ListBackupDevices(string ConnectionString)
        {
            List <string> backupNames = new List <string>();

            Server server = new Server(new ServerConnection(new SqlConnection(ConnectionString)));

            BackupDeviceCollection backups = server.BackupDevices;

            for (int i = 0; i < backups.Count; i++)
            {
                backupNames.Add(backups[i].Name);
            }

            return(backupNames.ToArray());
        }
コード例 #3
0
ファイル: VerifyBackup.cs プロジェクト: ramnaresh/SMO
        /// <summary>
        /// Get list of backup devices and add them to the combobox.
        /// </summary>
        private void GetBackupDevicesList()
        {
            Cursor csr = null;

            try
            {
                csr         = this.Cursor;        // Save the old cursor
                this.Cursor = Cursors.WaitCursor; // Display the waiting cursor

                // Clear controls
                BackupDeviceComboBox.Items.Clear();

                // Limit the properties returned to just those that we use
                SqlServerSelection.SetDefaultInitFields(typeof(BackupDevice),
                                                        new String[] { "Name", "BackupDeviceType",
                                                                       "PhysicalLocation" });

                // Get the appropriate BackupDevice object from the BackupDevices
                // collection of a connected SQLServer object.
                BackupDeviceList = SqlServerSelection.BackupDevices;

                // Get devices
                foreach (BackupDevice bkupDevice in BackupDeviceList)
                {
                    // Add device name to remove combo box
                    BackupDeviceComboBox.Items.Add(bkupDevice.Name);
                }

                if (BackupDeviceComboBox.Items.Count > 0)
                {
                    BackupDeviceComboBox.SelectedIndex = 0;
                }
            }
            catch (SmoException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
            finally
            {
                this.Cursor = csr;  // Restore the original cursor
            }
        }
コード例 #4
0
        public object GetBackupInformation(string BackupDeviceName, string ConnectionString)
        {
            Server server = new Server(new ServerConnection(new SqlConnection(ConnectionString)));

            BackupDeviceCollection backups = server.BackupDevices;

            System.Data.DataTable backupHeader = null;

            for (int i = 0; i < backups.Count; i++)
            {
                if (backups[i].Name.ToLower() == BackupDeviceName.ToLower())
                {
                    backupHeader = backups[i].ReadBackupHeader();

                    break;
                }
            }

            return(backupHeader);
        }
コード例 #5
0
ファイル: VerifyBackup.cs プロジェクト: rcdosado/SMO
        /// <summary>
        /// Get information for the selected backup device.
        /// </summary>
        /// <param name="BackupDeviceName"></param>
        private void GetBackupDeviceInfo(string BackupDeviceName)
        {
            BackupDevice bkupDevice;

            // Get the appropriate BackupDevice object from the BackupDevices
            // collection of a connected SQLServer object.
            BackupDeviceList = SqlServerSelection.BackupDevices;

            // Get selected device
            bkupDevice = BackupDeviceList[BackupDeviceName];

            DeviceTypeLabel.Text = bkupDevice.BackupDeviceType.ToString();
            StatusLabel.Text = bkupDevice.State.ToString();
            LocationLabel.Text = bkupDevice.PhysicalLocation;
        }
コード例 #6
0
ファイル: VerifyBackup.cs プロジェクト: rcdosado/SMO
        /// <summary>
        /// Get list of backup devices and add them to the combobox.
        /// </summary>
        private void GetBackupDevicesList()
        {
            Cursor csr = null;

            try
            {
                csr = this.Cursor;   // Save the old cursor
                this.Cursor = Cursors.WaitCursor;   // Display the waiting cursor

                // Clear controls
                BackupDeviceComboBox.Items.Clear();

                // Limit the properties returned to just those that we use
                SqlServerSelection.SetDefaultInitFields(typeof(BackupDevice),
                    new String[] { "Name", "BackupDeviceType", 
                        "PhysicalLocation" });

                // Get the appropriate BackupDevice object from the BackupDevices
                // collection of a connected SQLServer object.
                BackupDeviceList = SqlServerSelection.BackupDevices;

                // Get devices
                foreach (BackupDevice bkupDevice in BackupDeviceList)
                {
                    // Add device name to remove combo box
                    BackupDeviceComboBox.Items.Add(bkupDevice.Name);
                }

                if (BackupDeviceComboBox.Items.Count > 0)
                {
                    BackupDeviceComboBox.SelectedIndex = 0;
                }
            }
            catch (SmoException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
            finally
            {
                this.Cursor = csr;  // Restore the original cursor
            }
        }