本站首页    管理页面    写新日志    退出


«September 2025»
123456
78910111213
14151617181920
21222324252627
282930


公告
暂无公告...

我的分类(专题)

日志更新

最新评论

留言板

链接


Blog信息
blog名称:VFP及Sql Server拙笔
日志总数:46
评论数量:107
留言数量:0
访问次数:433305
建立时间:2005年5月12日




[VFP与SQL]VFP获取局域网内所有SqlServer
文章收藏,  网上资源,  软件技术,  电脑与网络

老瓷 发表于 2008/1/19 1:59:35

*-----------------------------------------------* 函数: 获取局域网内所有SqlServer* 设计: 红雨* 时间: 2005.04.01*-----------------------------------------------Function NetEnumSqlServer( tcTableName )    m.tcTableName = Iif(Type([m.tcTableName])=[C], m.tcTableName, [TNetEnumSqlServer])    Create Cursor (m.tcTableName) ( ServerName C(254) )    Declare SHORT SQLBrowseConnect In odbc32 Integer ConnectionHandle, String InConnectionString, Integer StringLength1, String  @ OutConnectionString, Integer   BufferLength, Integer @ StringLength2Ptr    Declare SHORT SQLAllocHandle In odbc32 Integer HandleType, Integer InputHandle, Integer @ OutputHandlePtr    Declare SHORT SQLFreeHandle In odbc32 Integer HandleType, Integer Handle    Declare SHORT SQLSetEnvAttr In odbc32 Integer EnvironmentHandle, Integer Attribute, Integer ValuePtr, Integer StringLength     Local hEnv, hConn, cInString, cOutString, nLenOutString, nCnt, iCnt    m.nCnt = 0    m.hEnv = 0    m.hConn = 0    m.cInString = "DRIVER=SQL SERVER"    m.cOutString = Space(2048)    m.nLenOutString = 0    Local Array aServerList[1]     If SQLAllocHandle(1, 0, @hEnv) = 0        If SQLSetEnvAttr(m.hEnv, 200, 3, 0) = 0            If SQLAllocHandle(2, m.hEnv, @hConn) = 0                If SQLBrowseConnect(m.hConn, @cInString, Len(m.cInString), @cOutString, 2048, @nLenOutString) = 99                    m.nCnt = Alines(aServerList, Strextract(m.cOutString, '{', '}'), .T., ',')                    For m.iCnt = 1 To m.nCnt                        Insert Into (m.tcTableName) Values ( aServerList[iCnt] )                    Endfor                Endif            Endif        Endif    EndifEndfunc


阅读全文(2944) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.032 second(s), page refreshed 144787599 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号