标题:如何建立与sybase的连接?
只看楼主
abinny
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-12-5
 问题点数:0 回复次数:2 
如何建立与sybase的连接?

Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form1_Load()

Dim strConnect As String

strConnect = "Provider=MSDASQL.1;DRIVER={Sybase System 11}; " _
& " Persist Security Info=False;DSN=;" _
& " SRVR=user_14;DB=esmart;UID=sa;PWD=888888"

conn.Open strConnect

连接不上去。。。我数据库在172.20.2.32上,应该如何配

搜索更多相关主题的帖子: sybase 
2006-12-05 15:09
bestfeng
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:179
专家分:0
注 册:2006-10-31
得分:0 
ODBC
2006-12-06 10:04
abinny
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-12-5
得分:0 

我在dsedit是这样设置的:
server name: user_14
server service: sql server
server status: 4 unknown
server address:tcp-172.20.2.18,8888

然后在sybase central用下面用户、密码可以登录上去
user id :sa
password: 888888
server name:user_14

最后,我在vb上代码是这样写的
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form1_Load()

Dim strConnect As String
Dim strSQL As String

strConnect = "Provider=MSDASQL.1;DRIVER={Sybase System 11}; " _
& " Persist Security Info=False;DSN=;" _
& " SRVR=user_14;DB=esmart;UID=sa;PWD=888888"

cnTest.Open strConnect

Set rs.ActiveConnection = conn
rs.CursorLocation = adUseClient
strSQL = "Select * from User_Info_Table"
rs.Open strSQL
Set DataGrid1.DataSource = rs
End Sub

现在问题是DataGrid1根本就没数据显示。我觉得原因在于连接不上sybase,不知道怎么写代码才能连上去,或者有什么其他解决办法

2006-12-06 11:35



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




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

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