数据库连接不上,求大虾帮忙解决啊,代码如下,是调用stream对象来存取二进制的.数据源也设了
taConn As New ADODB.Connection
Dim DataRec As New ADODB.Recordset
Dim strSQL As String
'若数据库连接出错,则转向ConnectionERR
On Error GoTo ConnectionERR
'建立一个连接字串
'这个连接串可能根据数据库配置的不同而不同
DataConn.ConnectionString = "Provider=SQLOLEDB.2;Integrated Security=SSPI;"
DataConn.ConnectionString = DataConn.ConnectionString & "Persist Security Info=true;"
DataConn.ConnectionString = DataConn.ConnectionString & "Initial Catalog=tempdb;"
DataConn.ConnectionString = DataConn.ConnectionString & "Data Source=localhost"
'建立数据库连接
DataConn.Open
'若RecordSet建立出错,则转向RecordsetERR
On Error GoTo RecordSetERR
strSQL = "SELECT * FROM Temp "
DataRec.Open strSQL, DataConn, adOpenDynamic, adLockOptimistic
If DataRec.EOF Then DataRec.AddNew