标题:开发网络版软件用VB如何的连接sqlserver2000数据库 请各位大虾指教!!! ...
只看楼主
武越
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-12-19
 问题点数:0 回复次数:3 
开发网络版软件用VB如何的连接sqlserver2000数据库 请各位大虾指教!!!!!
求救!!! 加1028344078 xiexie
搜索更多相关主题的帖子: 如何 开发 网络版 数据库 
2013-03-31 16:43
zsdtylj
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2013-4-12
得分:0 
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=chengben;Data Source=192.168.0.2"
cn.Open
2013-04-12 12:47
chenzr
Rank: 1
等 级:新手上路
帖 子:52
专家分:7
注 册:2007-9-27
得分:0 
这样吧...

Private Function ConnectToDatabase() As Boolean
On Error GoTo ErrHandler
Dim Conn As ADODB.Connection, DBName As String, ServerAdd As String, UserName As String, UserPwd As String
UserName = "sa"
UserPwd = ""
DBName = "数据库名"
ServerAdd = "服务器IP"
Conn.ConnectionTimeout = 10
Conn.CursorLocation = adUseClient
Conn.ConnectionString = "uid=" & UserName & ";pwd=" & UserPwd & ";driver={SQL SERVER};server=" & ServerAdd & ";database=" & DBName & ";dsn=''"
Conn.Open
ConnectToDatabase = True
Exit Function
ErrHandler:
MsgBox "错误信息:" & Err.Description, vbCritical, "警告"
Exit Function
End Function
2013-04-16 13:20
jefferman
Rank: 1
等 级:新手上路
帖 子:8
专家分:2
注 册:2011-5-30
得分:0 
用ADO控件,点击下鼠标就连接上了
2013-04-16 21:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-402504-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.569163 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved