VB连servers 2000问题
最近想弄个vb数据库,结果还没开始就碰钉子了。Public conn As New ADODB.Connection
Public re As New ADODB.Recordset
Public addFlage As Boolean
Public Function opencn() As Boolean
Dim mag As String
On Error GoTo strerrmag
Set conn = New ADODB.Connection
conn.ConnectionTimeout = 25
conn.Provider = "sqloledb"
conn.Properties("initial catalog").Value = xzh '服务器名字
conn.Properties("integrated security").Value = "sellsystem" '库名
conn.Properties("user id").Value = "sa"
conn.Properties("password").Value = "sa"
conn.Open
opencn = True
addflag = ture
Exit Function
strerrmag:
mag = "data can't connect"
Call MsgBox(mag, vbOKOnly, "error:data connect")
addflag = False
Exit Function
End Function
Private Sub Command1_Click()
Call opencn
End Sub
这是代码,本人绝对没有写错,就是连不上,而且用ADO能够连上那个数据库。郁闷死,在CSDN上挂了半天没个好答复。希望这里能帮我解决问题