如何编程判断局域网中的某台电脑是否安装了MSSQLSERVER及其所运行的是什么操作系统(win98/2K/XP/2003)

解决方案 »

  1.   

    msdn的高人们去哪了555555555555555555555555555555555555555
      

  2.   

    操作系统用Request.ServerVariables("HTTP_USER_AGENT")
    例如写个函数
    Private Function GetSystemName()
            '操作系统版本 
            Dim agent As String = Request.ServerVariables("HTTP_USER_AGENT")
            Dim systemver As String
            If InStr(agent, "NT 5.2") > 0 Then
                systemver = "Windows Server 2003"
            ElseIf InStr(agent, "NT 5.1") > 0 Then
                systemver = "Windows XP"
            ElseIf InStr(agent, "NT 5") > 0 Then
                systemver = "Windows 2000"
            ElseIf InStr(agent, "NT 4") > 0 Then
                systemver = "Windows NT4"
            ElseIf InStr(agent, "4.9") > 0 Then
                systemver = "Windows ME"
            ElseIf InStr(agent, "98") > 0 Then
                systemver = "Windows 98"
            ElseIf InStr(agent, "95") > 0 Then
                systemver = "Windows 95"
            Else
                systemver = "未知"
            End If
            Return systemver
        End Function
    sqlserver问题,可以看1433端口开没判断
      

  3.   

    你可以用wmi来获得,不过需要知道机器的用户名和密码,
    参看
    http://www.codeproject.com/csharp/wmi.asp
      

  4.   

    http://www.insecure.org/nmap/index.html
      

  5.   

    #region MSSQL数据库服务器探测
    /// <summary>
    /// MSSQL数据库服务器探测
    /// </summary>
    #endregion
    public class ExploreSQLServer
    {
    #region 字段 #region 接收数据完成
    /// <summary>
    /// 接收数据完成
    /// </summary>
    #endregion
    public event System.EventHandler OnReceiveComplete; #region Socket通讯对象
    /// <summary>
    /// Socket通讯对象
    /// </summary>
    #endregion
    private System.Net.Sockets.UdpClient udpSocket; #region MSSQL服务器监听端口
    /// <summary>
    /// MSSQL服务器监听端口
    /// </summary>
    #endregion
    private const int SQL_PORT = 1434; #region 发送的探测数据
    /// <summary>
    /// 发送的探测数据
    /// </summary>
    #endregion
    private byte[] BytesSendData = new byte[]{ 2 }; #region 接收数据的临时缓冲区
    /// <summary>
    /// 接收数据的临时缓冲区
    /// </summary>
    #endregion
            private byte[] byteBuffer = new byte[ 1024 ]; private const int LOCAL_PORT = 24905; #region 线程等待毫秒数
    /// <summary>
    /// 线程等待毫秒数
    /// </summary>
    #endregion
    private const int WAITING_VALUE = 1000; #region 接收数据等待时间
    /// <summary>
    /// 接收数据等待时间
    /// </summary>
    #endregion
    private const int RECEIVE_VALUE = 1000; #region 远程IP地址
    /// <summary>
    /// 远程IP地址
    /// </summary>
    #endregion
    private System.Net.IPEndPoint objRemoteIP; #region 广播地址
    /// <summary>
    /// 广播地址
    /// </summary>
    #endregion
    private const string strGroupIP = "255.255.255.255"; #region 服务器列表
    /// <summary>
    /// 服务器列表
    /// </summary>
    #endregion
    private System.Collections.ArrayList alServerList; #region 接收数据的计时器
    /// <summary>
    /// 接收数据的计时器
    /// </summary>
    #endregion
    private System.Timers.Timer tmReceive; #region 操作线程
    /// <summary>
    /// 操作线程
    /// </summary>
    #endregion
            private System.Threading.Thread workThread;
    #endregion #region 默认构造函数
    /// <summary>
    /// 默认构造函数
    /// </summary>
    #endregion
    public ExploreSQLServer()
    {
    this.udpSocket = new UdpClient();
    this.objRemoteIP = new IPEndPoint( IPAddress.Parse(strGroupIP),SQL_PORT );
    this.alServerList = new ArrayList();
    this.tmReceive = new System.Timers.Timer();
    this.tmReceive.Interval = RECEIVE_VALUE;
    this.tmReceive.Elapsed += new System.Timers.ElapsedEventHandler(tmReceive_Elapsed);
    this.workThread = new System.Threading.Thread( new System.Threading.ThreadStart(this.SendBroadCast) );
    }
    #region 属性 #region 服务器列表
    /// <summary>
    /// 服务器列表
    /// </summary>
    #endregion
    public ArrayList ServerList
    {
    get{ return this.alServerList; }
    } #endregion #region 方法 #region 开始执行
    /// <summary>
    /// 开始执行
    /// </summary>
    #endregion
    public void Start()
    {
    if( this.workThread.ThreadState == ThreadState.Unstarted )
    {
    this.workThread.Start();
    }
    else if( this.workThread.ThreadState == ThreadState.Suspended )
    {
    this.workThread.Resume();
    }
    }
    #region 发出广播消息
    /// <summary>
    /// 发出广播消息
    /// </summary>
    #endregion
    private void SendBroadCast()
    {
    try
    {
    this.udpSocket.Send( BytesSendData,1,this.objRemoteIP );
    while( true )
    {
    this.tmReceive.Enabled = true;
    this.tmReceive.Interval = RECEIVE_VALUE;
    byte[] byteRece = this.udpSocket.Receive( ref this.objRemoteIP );
    Console.WriteLine("add in {0}",DateTime.Now );
    this.alServerList.Add( new SQLServer(  byteRece ,this.objRemoteIP.Address.ToString() ) );
    this.tmReceive.Enabled = false;
    }
    }
    catch{}
    }
    #region 关闭Socket对象
    /// <summary>
    /// 关闭Socket对象
    /// </summary>
    #endregion
    public void Close()
    {
    this.workThread.Abort();
    this.udpSocket.Close();
    }
    #region 解析服务器名称
    /// <summary>
    /// 解析服务器名称
    /// </summary>
    /// <param name="buffer"></param>
    /// <returns></returns>
    #endregion
    private string ParseServerName( byte[] buffer )
    {
    return string.Empty;
    } #endregion #region 事件 #region 触发接收计时器
    /// <summary>
    /// 触发接收计时器
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void tmReceive_Elapsed( object sender, System.Timers.ElapsedEventArgs e )
    {
    //停止线程
    if( this.workThread.ThreadState != System.Threading.ThreadState.Aborted )
    {
    this.workThread.Suspend();
    }
    this.tmReceive.Stop();
    this.OnReceiveMessageCompleteEvent( new EventArgs() );
    }
    #region 引发接收数据完成事件
    /// <summary>
    /// 引发接收数据完成事件
    /// </summary>
    /// <param name="e"></param>
    #endregion
    protected virtual void OnReceiveMessageCompleteEvent( System.EventArgs e )
    {
    if( this.OnReceiveComplete != null )
    {
    this.OnReceiveComplete( this,e );
    }
    }
    #endregion
    } //class ExploreSQLServer
      

  6.   

    #region 数据库服务对象
    /// <summary>
    /// 数据库服务对象
    /// </summary>
    #endregion
    public class SQLServer
    {
    #region 服务器名称
    /// <summary>
    /// 服务器名称
    /// </summary>
    #endregion
    private string strServerName; #region 服务器IP
    /// <summary>
    /// 服务器IP
    /// </summary>
    #endregion
    private string strIP; #region 数据库实例名称
    /// <summary>
    /// 数据库实例名称
    /// </summary>
    #endregion
    private string strInstanceName; #region 服务器版本号
    /// <summary>
    /// 服务器版本号
    /// </summary>
    #endregion
    private string strVersion; #region 服务器TCP端口
    /// <summary>
    /// 服务器TCP端口
    /// </summary>
    #endregion
    private int nTcpPort; #region 用户名
    /// <summary>
    /// 用户名
    /// </summary>
    #endregion
    public string strUserName = string.Empty; #region 密码
    /// <summary>
    /// 密码
    /// </summary>
    #endregion
    public string strPassword = string.Empty; #region 数据库名称
    /// <summary>
    /// 数据库名称
    /// </summary>
    #endregion
    public string strDataBaseName = string.Empty; public SQLServer(){} #region 构造函数
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="buffer">接收的数据流</param>
    /// <param name="ip">服务器IP地址</param>
    #endregion
    public SQLServer( byte[] buffer, string ip )
    {
    this.strIP = ip;
    try
    {
    if( buffer.Length > 3 )
    {
    byte[] bTmp = new byte[ buffer.Length - 3 ];
    for( int i = 0; i < bTmp.Length; i++ )
    {
    bTmp[i] = buffer[ i + 3 ];
    }
    string strTmp = System.Text.Encoding.Default.GetString( bTmp,0,bTmp.Length - 1 );
    // Console.WriteLine( strTmp );
    string[] strArr = strTmp.Split( new char[]{';'} );
    //服务器名称
    if( strArr.Length >= 2 )
    {
    this.strServerName = strArr[1];
    }
    //实例名称
    if( strArr.Length >= 4 )
    {
    this.strInstanceName = strArr[3];
    }
    //版本号
    if( strArr.Length >= 8 )
    {
    this.strVersion = strArr[7];
    }
    //TCP端口
    if( strArr.Length >= 10 )
    {
    this.nTcpPort = Convert.ToInt32( strArr[9] );
    }
    }
    }
    catch
    {
    this.strServerName = string.Empty;
    this.strInstanceName = string.Empty;
    this.strVersion = string.Empty;
    this.nTcpPort = 0;
    }
    }
    #region 服务器名称
    /// <summary>
    /// 服务器名称
    /// </summary>
    #endregion
    public string ServerName
    {
    get{ return this.strServerName; }
    }
    #region 服务器IP
    /// <summary>
    /// 服务器IP
    /// </summary>
    #endregion
    public string ServerIP
    {
    get{ return this.strIP; }
    }
    #region 数据库实例名称
    /// <summary>
    /// 数据库实例名称
    /// </summary>
    #endregion
    public string InstanceName
    {
    get{ return this.strInstanceName; }
    }
    #region 服务器版本号
    /// <summary>
    /// 服务器版本号
    /// </summary>
    #endregion
    public string ServerVersion
    {
    get{ return this.strVersion; }
    }
    #region 服务器TCP端口
    /// <summary>
    /// 服务器TCP端口
    /// </summary>
    #endregion
    public int TcpPort
    {
    get{ return this.nTcpPort; }
    } public override string ToString()
    {
    return String.Format( "服务器名称:{0}\r\n服务器IP:{1}\r\n实例名称:{2}\r\n版本号:{3}\r\n端口号:{4}\r\n用户名:{5}\r\n密码:{6}\r\n数据库名称:{7}",this.strServerName,this.strIP,this.strInstanceName,this.strVersion,this.nTcpPort,this.strUserName,this.strPassword,this.strDataBaseName );
    } }
      

  7.   

    以上是获取局域网内SQL服务器信息。至于操作系统,除了以上方法,可以考虑用PING命令来获取返回的TTL值来分析是那个操作系统。
      

  8.   

    zhgroup(Hotel California) :  能不能给个应用的例子,谢谢!!!
      

  9.   

    /// <summary>
    /// ConnectForm 的摘要说明。
    /// </summary>
    public class SQLForm : System.Windows.Forms.Form
    {
    private System.Windows.Forms.GroupBox gpBoxInput;
    private System.Windows.Forms.Label lblUserName;
    private System.Windows.Forms.Label lblPassword;
    private System.Windows.Forms.Button btnOK;
    private System.Windows.Forms.Button btnCancel;
    private System.Windows.Forms.TextBox txbUserName;
    private System.Windows.Forms.TextBox txbPassword;
    private System.Windows.Forms.Label lblServer;
    private System.Windows.Forms.ComboBox cmbServer;
    private System.Windows.Forms.Button btnRef;
    private System.Windows.Forms.Button btnConnection;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public SQLForm()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.gpBoxInput = new System.Windows.Forms.GroupBox();
    this.btnConnection = new System.Windows.Forms.Button();
    this.btnRef = new System.Windows.Forms.Button();
    this.cmbServer = new System.Windows.Forms.ComboBox();
    this.txbUserName = new System.Windows.Forms.TextBox();
    this.btnOK = new System.Windows.Forms.Button();
    this.lblUserName = new System.Windows.Forms.Label();
    this.lblPassword = new System.Windows.Forms.Label();
    this.btnCancel = new System.Windows.Forms.Button();
    this.txbPassword = new System.Windows.Forms.TextBox();
    this.lblServer = new System.Windows.Forms.Label();
    this.gpBoxInput.SuspendLayout();
    this.SuspendLayout();
    // 
    // gpBoxInput
    // 
    this.gpBoxInput.Controls.Add(this.btnConnection);
    this.gpBoxInput.Controls.Add(this.btnRef);
    this.gpBoxInput.Controls.Add(this.cmbServer);
    this.gpBoxInput.Controls.Add(this.txbUserName);
    this.gpBoxInput.Controls.Add(this.btnOK);
    this.gpBoxInput.Controls.Add(this.lblUserName);
    this.gpBoxInput.Controls.Add(this.lblPassword);
    this.gpBoxInput.Controls.Add(this.btnCancel);
    this.gpBoxInput.Controls.Add(this.txbPassword);
    this.gpBoxInput.Controls.Add(this.lblServer);
    this.gpBoxInput.ForeColor = System.Drawing.Color.Navy;
    this.gpBoxInput.Location = new System.Drawing.Point(10, 10);
    this.gpBoxInput.Name = "gpBoxInput";
    this.gpBoxInput.Size = new System.Drawing.Size(378, 192);
    this.gpBoxInput.TabIndex = 0;
    this.gpBoxInput.TabStop = false;
    this.gpBoxInput.Text = "请输入访问数据的用户名和密码";
    // 
    // btnConnection
    // 
    this.btnConnection.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.btnConnection.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
    this.btnConnection.Location = new System.Drawing.Point(279, 153);
    this.btnConnection.Name = "btnConnection";
    this.btnConnection.Size = new System.Drawing.Size(75, 25);
    this.btnConnection.TabIndex = 5;
    this.btnConnection.Text = "测试连接";
    this.btnConnection.Click += new System.EventHandler(this.btnConnection_Click);
    // 
    // btnRef
    // 
    this.btnRef.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.btnRef.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
    this.btnRef.ForeColor = System.Drawing.Color.Navy;
    this.btnRef.Location = new System.Drawing.Point(312, 41);
    this.btnRef.Name = "btnRef";
    this.btnRef.Size = new System.Drawing.Size(51, 24);
    this.btnRef.TabIndex = 4;
    this.btnRef.Text = "刷新";
    this.btnRef.Click += new System.EventHandler(this.btnRef_Click);
      

  10.   

    // 
    // cmbServer
    // 
    this.cmbServer.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.cmbServer.ForeColor = System.Drawing.Color.Navy;
    this.cmbServer.Location = new System.Drawing.Point(147, 42);
    this.cmbServer.Name = "cmbServer";
    this.cmbServer.Size = new System.Drawing.Size(153, 20);
    this.cmbServer.TabIndex = 3;
    this.cmbServer.Text = "192.168.0.14";
    // 
    // txbUserName
    // 
    this.txbUserName.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.txbUserName.ForeColor = System.Drawing.Color.Navy;
    this.txbUserName.Location = new System.Drawing.Point(147, 81);
    this.txbUserName.Name = "txbUserName";
    this.txbUserName.Size = new System.Drawing.Size(152, 21);
    this.txbUserName.TabIndex = 2;
    this.txbUserName.Text = "sa";
    // 
    // btnOK
    // 
    this.btnOK.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
    this.btnOK.ForeColor = System.Drawing.Color.Navy;
    this.btnOK.Location = new System.Drawing.Point(31, 153);
    this.btnOK.Name = "btnOK";
    this.btnOK.Size = new System.Drawing.Size(75, 25);
    this.btnOK.TabIndex = 1;
    this.btnOK.Text = "确定";
    this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
    // 
    // lblUserName
    // 
    this.lblUserName.ForeColor = System.Drawing.Color.Navy;
    this.lblUserName.Location = new System.Drawing.Point(12, 79);
    this.lblUserName.Name = "lblUserName";
    this.lblUserName.Size = new System.Drawing.Size(99, 23);
    this.lblUserName.TabIndex = 0;
    this.lblUserName.Text = "用户名";
    this.lblUserName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    // 
    // lblPassword
    // 
    this.lblPassword.ForeColor = System.Drawing.Color.Navy;
    this.lblPassword.Location = new System.Drawing.Point(12, 117);
    this.lblPassword.Name = "lblPassword";
    this.lblPassword.Size = new System.Drawing.Size(99, 23);
    this.lblPassword.TabIndex = 0;
    this.lblPassword.Text = "密码";
    this.lblPassword.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    // 
    // btnCancel
    // 
    this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
    this.btnCancel.ForeColor = System.Drawing.Color.Navy;
    this.btnCancel.Location = new System.Drawing.Point(155, 153);
    this.btnCancel.Name = "btnCancel";
    this.btnCancel.Size = new System.Drawing.Size(75, 25);
    this.btnCancel.TabIndex = 1;
    this.btnCancel.Text = "取消";
    this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
    // 
    // txbPassword
    // 
    this.txbPassword.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
    this.txbPassword.ForeColor = System.Drawing.Color.Navy;
    this.txbPassword.Location = new System.Drawing.Point(147, 119);
    this.txbPassword.Name = "txbPassword";
    this.txbPassword.Size = new System.Drawing.Size(152, 21);
    this.txbPassword.TabIndex = 2;
    this.txbPassword.Text = "sa";
    // 
    // lblServer
    // 
    this.lblServer.ForeColor = System.Drawing.Color.Navy;
    this.lblServer.Location = new System.Drawing.Point(12, 41);
    this.lblServer.Name = "lblServer";
    this.lblServer.Size = new System.Drawing.Size(99, 23);
    this.lblServer.TabIndex = 0;
    this.lblServer.Text = "服务器";
    this.lblServer.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    // 
    // SQLForm
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(398, 212);
    this.Controls.Add(this.gpBoxInput);
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
    this.MaximizeBox = false;
    this.MinimizeBox = false;
    this.Name = "SQLForm";
    this.ShowInTaskbar = false;
    this.Text = "登录数据库";
    this.Load += new System.EventHandler(this.SQLForm_Load);
    this.gpBoxInput.ResumeLayout(false);
    this.ResumeLayout(false); }
    #endregion #region 初始化
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void SQLForm_Load(object sender, System.EventArgs e)
    {
    this.m_Explore = new ExploreSQLServer();
    this.m_Explore.OnReceiveComplete += new EventHandler(m_Explore_OnReceiveComplete);
    }
      

  11.   


    #region SQL数据库连接字符串
    /// <summary>
    /// SQL数据库连接字符串
    /// </summary>
    #endregion
    private string strConn = string.Empty; #region SQL服务器探测对象
    /// <summary>
    /// SQL服务器探测对象
    /// </summary>
    #endregion
    private ExploreSQLServer m_Explore; #region SQL数据库连接字符串
    /// <summary>
    /// SQL数据库连接字符串
    /// </summary>
    #endregion
    public string ConnectionString
    {
    get
    {
    string strTmp = string.Empty;
    string serverIP = this.cmbServer.Text;
    foreach( SQLServer server in this.m_Explore.ServerList )
    {
    if( server.ServerName == this.cmbServer.Text )
    {
    serverIP = server.ServerIP;
    break;
    }
    }
    strTmp = GlobalConfig.SQLConnection( this.txbUserName.Text,this.txbPassword.Text,serverIP );
    return strTmp;
    }
    }
    #region 服务器名称
    /// <summary>
    /// 服务器名称
    /// </summary>
    #endregion
    public string ServerName
    {
    get
    {
    return this.cmbServer.Text;
    }
    }
    #region 确定
    /// <summary>
    /// 确定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void btnOK_Click(object sender, System.EventArgs e)
    {
    this.m_Explore.Close();
    this.DialogResult = DialogResult.OK;
    }
    #region 取消
    /// <summary>
    /// 取消
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void btnCancel_Click(object sender, System.EventArgs e)
    {
    this.m_Explore.Close();
    this.DialogResult = DialogResult.Cancel;
    }
    #region 刷新服务器列表
    /// <summary>
    /// 刷新服务器列表
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void btnRef_Click(object sender, System.EventArgs e)
    {
    this.m_Explore.Start();
    this.Cursor = Cursors.WaitCursor;
    }
    #region 探测服务器完成
    /// <summary>
    /// 探测服务器完成
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void m_Explore_OnReceiveComplete( object sender, System.EventArgs e )
    {
    try
    {
    this.Cursor = Cursors.Arrow;
                    this.cmbServer.Items.Clear();
    foreach( SQLServer server in this.m_Explore.ServerList )
    {
    this.cmbServer.Items.Add( server.ServerName );
    }
    if( this.cmbServer.Items.Count > 0 )
    {
    this.cmbServer.SelectedIndex = 0;
    }
    }
    catch( Exception ex )
    {
    Common.ShowMessage.ShowError( ex.Message );
    }
    }
    #region 测试连接
    /// <summary>
    /// 测试连接
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    #endregion
    private void btnConnection_Click(object sender, System.EventArgs e)
    {
    //获取数据库连接字符串
    this.strConn = GlobalConfig.SQLConnection( this.txbUserName.Text,this.txbPassword.Text,this.cmbServer.Text );
    SQLProvider sqlProvider = new SQLProvider( this.strConn );
    try
    {
    this.Cursor = Cursors.WaitCursor;
    sqlProvider.Open();
    foreach( SQLServer server in this.m_Explore.ServerList )
    {
    if( server.ServerName == this.cmbServer.Text )
    {
    server.strUserName = this.txbUserName.Text;
    server.strPassword = this.txbPassword.Text;
    break;
    }
    }
    Common.ShowMessage.ShowInformation( "数据库连接成功!" );
    }
    catch( Exception ex )
    {
    Common.ShowMessage.ShowError( ex.Message );
    }
    finally
    {
    sqlProvider.Dispose();
    this.Cursor = Cursors.Arrow;
    }
    }
    }
      

  12.   

    zhgroup、szj820 (都市精灵,机会没有,鸡会有的,努力努力)
    问下:
    GlobalConfig、SQLProvider和Common是哪儿引用的类?