用vb6創建odbc為什麼不行?進入看代碼 ?

leotan_yang 2003-12-12 05:18:06
#If Win32 Then
Dim intRet As Long
#Else
Dim intRet As Integer
#End If
Dim strDriver As String
Dim strAttributes As String

'Set the driver to SQL Server because it is most common.
strDriver = "SQL Server"
'Set the attributes delimited by null.
'See driver documentation for a complete
'list of supported attributes.
strAttributes = "SERVER=(local)" & Chr$(0)
strAttributes = strAttributes & "DESCRIPTION=TempDSN" & Chr$(0)
strAttributes = strAttributes & "DSN=TEM" & Chr$(0)
strAttributes = strAttributes & "DATABASE=trade" & Chr$(0)
strAttributes = strAttributes & "UID=sa" & Chr$(0)
strAttributes = strAttributes & "PWD=" & Chr$(0)

'strAttributes = "SERVER=(local) DSN=ttt DATABASE=trade UID=sa"

'show dialog, use Form1.Hwnd instead of vbAPINull.
intRet = SQLConfigDataSource(vbAPINull, 4, strDriver, strAttributes)
If intRet Then
MsgBox "DSN Created"
Else
MsgBox "Create Failed"
End If
...全文
10 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
leotan_yang 2003-12-15
試過啦,系2000系統中,不是不行
  • 打赏
  • 举报
回复
yoki 2003-12-12
要用;分隔
'strAttributes = "SERVER=(local) DSN=ttt DATABASE=trade UID=sa"
改成
'strAttributes = "SERVER=(local);DSN=ttt ;ATABASE=trade;UID=sa"

即将 Chr$(0)改成";"
  • 打赏
  • 举报
回复
相关推荐
发帖
数据库(包含打印,安装,报表)
加入

1198

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2003-12-12 05:18
社区公告
暂无公告