⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmdbutility.cs

📁 使用SQL Server Agent 自动对SQLServer数据库进行自动备份
💻 CS
字号:

//'---------> Created by Joshy George <----------
//'---------> Use this as you like, no copyright, no restrictions <----------
//'---------> All I want is to Give, because I have Received  <----------
//'---------> So much help from others.Thank You ! <----------

///* This is my sample program for Creating SQL Server Jobs 
// * Feel free to change or modify the code, and use it,it sure would be nice to
// * give me credit for something if you do use this in something that you make for yourself
// * or others, but what you do if up to you.
// * Questions or Comments may be addressed to Spot <joshygeo@gmail.com>, 
// * and you can find more  information on my web-site (http://www.joshygeo.tk).  
// * This code is free to use modify and distribute, so long as what your doing with it is also free, 
// * I'd like to here about any interesting modifications that other programmers come up with.

//'---------> Email:-  joshygeo@gmail.com <----------
//'---------> WebSite:- www.joshygeo.tk <----------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SQLDMO;

namespace dbMaintain
{
    public partial class frmdbUtility : Form
    {
        SQLDMO._SQLServer SQLServer = new SQLDMO.SQLServerClass();

        public frmdbUtility()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            BL.BusinessLogicLayer BLL = new BL.BusinessLogicLayer();
            BLL.dIsplayServerList(cboServers);
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Info.informationLayer info = new Info.informationLayer();
            BL.BusinessLogicLayer BLL = new BL.BusinessLogicLayer();

            info.strServerName = cboServers.Text.ToString();
            info.strLoginName = txtUser.Text.ToString();
            info.strPwd = txtPassword.Text.ToString();
            BLL.dIsplayDatabases(cboDatabase, info);
            groupBox1.Enabled = true;
        }

        private void btnCrJobs_Click(object sender, EventArgs e)
        {
            Info.informationLayer info = new Info.informationLayer();
            BL.BusinessLogicLayer BLL = new BL.BusinessLogicLayer();

            info.strServerName = cboServers.Text.ToString();
            info.strLoginName = txtUser.Text.ToString();
            info.strPwd = txtPassword.Text.ToString();
            info.strDatabaseName = cboDatabase.Text.ToString();

            info.intStartDate = dtpStartDay.Value.Year * 10000 + dtpStartDay.Value.Month * 100 + dtpStartDay.Value.Day;
            info.intStartTime = dtpStartTime.Value.Hour * 10000 + dtpStartTime.Value.Minute * 100 + dtpStartTime.Value.Second;

            BLL.CreateJob_Sql(info);
            BLL.CreateShedule_Sql(info);

            if (info.ErrorMessageDataLayer != null)
            {
                MessageBox.Show(info.ErrorMessageDataLayer.ToString());
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -