using System;
using SQLDMO;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace bakServe040907
{
/// <summary>
/// 数据库备份类说明
/// </summary>
public class bakServer
{
string ServerName; //数据服务器名称
string UserName; //用户名称
string Password; //用户密码
string message; //消息提示
ProgressBar PBar; //状态条控件
public bakServer()
{
}
/// <summary>
/// 取得数据库服务器列表
/// </summary>
/// <returns>数据库服务器列表</returns>
public ArrayList GetServerList()
{
ArrayList alServers = new ArrayList() ;
SQLDMO.Application sqlApp = new SQLDMO.ApplicationClass() ;
try
{
SQLDMO.NameList serverList = sqlApp.ListAvailableSQLServers() ;
for(int i = 1;i<= serverList.Count;i++)
{
alServers.Add(serverList.Item(i)) ;
}
}
catch(Exception e)
{
// throw(new Exception("取数据库服务器列表出错:"+e.Message)) ;
message = "取数据库服务器列表出错:" +e.Message;
}
finally
{
sqlApp.Quit() ;
}
return alServers ;
}
/// <summary>
/// 错误消息处理
/// </summary>
/// <returns>消息信息</returns>
public string Msg()
{
return message;
}
/// <summary>
/// 取得指定数据库列表
/// </summary>
/// <param name="strServerName">服务器名称</param>
/// <param name="strUserName">用户名称</param>
/// <param name="strPwd">用户密码</param>
/// <returns>数据库列表</returns>
public ArrayList GetDbList(string strServerName,string strUserName,string strPwd)
{
ServerName = strServerName ;
UserName = strUserName ;
Password = strPwd ;
ArrayList &n