打印本文 打印本文 关闭窗口 关闭窗口
获取Sql服务器列表 (C#)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数5942  更新时间:2007/11/14 11:14:46  文章录入:mintao  责任编辑:mintao
[DllImport("odbc32.dll")]
private static extern short SQLSetEnvAttr(IntPtr henv, int attribute, IntPtr valuePtr, int strLength);
[DllImport(
"odbc32.dll")]
private static extern short SQLFreeHandle(short hType, IntPtr handle);
[DllImport(
"odbc32.dll",CharSet=CharSet.Ansi)]
private static extern short SQLBrowseConnect(IntPtr hconn, StringBuilder inString,
short inStringLength, StringBuilder outString, short outStringLength,
out short outLengthNeeded);

private const short SQL_HANDLE_ENV = 1;
private const short SQL_HANDLE_DBC = 2;
private const int SQL_ATTR_ODBC_VERSION = 200;
private const int SQL_OV_ODBC3 = 3;
private const short SQL_SUCCESS = 0;

private const short SQL_NEED_DATA = 99;
private const short DEFAULT_RESULT_SIZE = 1024;
private const string SQL_DRIVER_STR = "DRIVER=SQL SERVER";

private SqlLocator()
打印本文 打印本文 关闭窗口 关闭窗口