PB获取局域网MsSQL Server列表

阅读更多

 用OLE获取局域网的MsSQL Server列表

 

OLEObject   SQLServer,   ServerList   
string   jk   
integer   i,nServers   
long   ll_status   
SQLServer   =   CREATE   OLEObject   
ServerList   =   CREATE   OLEObject   
ll_status   =   SQLServer.ConnectToNewObject("SQLDMO.Application")   
IF   ll_status   <>   0   THEN   
    //   Handle   the   error   
ELSE   
    ServerList   =SQLServer.ListAvailableSQLServers()   
    nServers   =   ServerList.Count   
  
    for   i   =   1   to   nServers   
          jk=string(serverlist.item(i))   
          ddlb_1.additem(jk)   
    next   
END   IF   
    
DESTROY   SQLServer;   
DESTROY   ServerList;   

你可能感兴趣的:(PB获取局域网MsSQL Server列表)