扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:刘兴权 陈奇 谢树春 来源:计算机信息技术 2007年10月14日
关键字: VB 文件数据 SQL Server 上传下载
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist;Security Info=False;Initial Catalog=Science_File;Data Source=Data_Server |
dim odbcstr as String, adocon As New ADODB.Connection odbcstr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;_ Initial Catalog=Science_File;Data Source=Data_Server" adocon.Open odbcstr '连接到数据库 |
Private Declare Function NetServerEnum Lib "netapi32" _ (lpServer As Any, ByVal lLevel As Long, vBuffer As Any, _ lPreferedMaxLen As Long, lEntriesRead As Long, lTotalEntries As Long, _ ByVal lServerType As Long, ByVal sDomain$, vResume As Any) As Long Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination _ As Any, Source As Any, ByVal Length As Long) Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long Private Type SV_100 platform As Long name As Long End Type dim sv100 As SV_100, nRet As Long, i as long, lServerInfo As Long dim lServerInfo As Long, lPreferedMaxLen As Long, lEntriesRead As Long dim lTotalEntries As Long, sDomain As String, vResume As Variant dim buffer() As Byte, nLen As Long lPreferedMaxLen = 65536 nRet = NetServerEnum(0, 101, lServerInfo, lPreferedMaxLen, lEntriesRead, lTotalEntries, 4, sDomain, vResume) If nRet = 0 Or nRet = 234& Then For i = 0 To lEntriesRead - 1 CopyMemory sv100, ByVal lServerInfo, Len(sv100) nLen = lstrlenW(sv100.name) * 2 If nLen Then ReDim buffer(0 To (nLen - 1)) As Byte CopyMemory buffer(0), ByVal sv100.name, nLen End If Combo1.List(i) = buffer '服务器名 lServerInfo = lServerInfo + 24 Next i End If |
odbcstr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;_ Initial Catalog=Science_File;Data Source=" & Form2.Combo1.Text adocon.Open odbcstr '连接到数据库 |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者