这几天在写一个winform
就是查询局域网内任意sql server上的数据
在调用COM组件SQLDMO时出现一些问题,一直没得到解决
部分测试代码
using System;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading;
using SQLDMO;
namespace ConsoleApplication2
{
    
/// <summary>
    
/// Class1 的摘要说明。
    
/// </summary>
    class Class1
    {
        
/// <summary>
        
/// 应用程序的主入口点。
        
/// </summary>
        
        [STAThread]
        
static void Main(string[] args)
        {
            
//
            
// TODO: 在此处添加代码以启动应用程序
            
//
            SQLDMO.NameList ns; 
            SQLDMO.ApplicationClass rs
=new SQLDMO.ApplicationClass(); 
            
try 
            { 
                ns
= rs.ListAvailableSQLServers(); 
                
for(int i=0;i<ns.Count;i++)
                { 
                    Console.WriteLine(ns.Item(i));
                } 
            } 
            
catch(Exception ex) 
            { 
                Console.WriteLine(ex.ToString()); 
            } 

        }
    }
}
运行失败:
提示接口SQLDMO.NameList的QueryInterface失败

有朋友写过类似的程序吗?上面哪个部分出现问题?调试时错误的行是