打印本文 打印本文 关闭窗口 关闭窗口
获取Sql服务器列表 (C#)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4947  更新时间:2007/11/14 11:14:46  文章录入:mintao  责任编辑:mintao

怎么实现这个功能大家肯定早都知道了,放上来是给自己留个备份
使用:

private void button1_Click_1(object sender, System.EventArgs e)
{
string[] servers = DBGrep.SqlLocator.GetServers();
foreach ( string s in servers )
{
this.listBox1.Items.Add(s);
}

}

类的代码
using System;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;

namespace DBGrep
{
public class SqlLocator
{
[DllImport(
"odbc32.dll")]
private static extern short SQLAllocHandle(short hType, IntPtr inputHandle, out IntPtr outputHandle);

[1] [2] [3] [4] [5] [6]  下一页

打印本文 打印本文 关闭窗口 关闭窗口