设为首页
加入收藏夹

如何获取局域网中的所有 SQL Server 服
浏览选项:

>procedure TFormServersList.CB_DataNamesDropDown(Sender: TObject);

var

  icount ,Server_B : integer;

begin

  CB_DataNames.Clear;

  Screen.Cursor := CrHourGlass;

  Server_B := CB_ServerNames.Items.IndexOf(CB_ServerNames.Text) ;

  with PdmoObject[Server_B].SQL_DMO do

  begin

    if not PdmoObject[Server_B].lConnected then

    try

      Connect(Name,Trim(Ed_Login.Text),Trim(Ed_Pwd.Text));

    except

      Screen.Cursor := CrDefault ;

      Application.MessageBox('请检查用户名或密码是否正确','连接失败',MB_OK);

      Exit ;

    end;

    if not VerifyConnection(SQLDMOConn_ReconnectIfDead) then

    begin

      ShowMessage('在试图连接到SQL SERVER 2000 时出现错误' + #10#13 +

                             '确信是否加在了动态连接库SQLDMO.DLL');

      exit;

    end else

      PdmoObject[Server_B].lConnected := True ;

    Databases.Refresh(true);

    for icount := 1 to Databases.Count do

      CB_DataNames.Items.Add(Databases.Item(icount,null).name);

  end;

  Screen.Cursor := CrDefault ;

end

end.

 


[首页]    [上一页]    [下一页]    [末页]    

Copyright © 2004 wanxu.com All Rights Reserved