I am trying to implement a three tier client/server database using VB, and SQL Server.
I am having trouble with the connection string in my data services tier. The code can be seen below:
Private Sub Class_Initialize()
'Create the Recordsets
On Error GoTo HandleError
Set conParthus = New ADODB.Connection
Set rsBUDept = New ADODB.Recordset
Set rsOffice = New ADODB.Recordset
'Open the Connection
conParthus.ConnectionString = "driver={SQL Server};" & _
"server=W98SYSREC;uid=;pwd=;database=Parthus;Trusted_Connection=Yes;"
conParthus.Open
Debug.Print "Connection1 successful"
'Open the rsBUDept Recordset
With rsBUDept
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "Select * from BUDepts", conParthus, , , adCmdText
End With
'Open the rsOffice Recordset
With rsOffice
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "Select OfficeID, OfficeName from Office", _
conParthus, , , adCmdText
End With
'Add Recordsets to the DataMembers collection
With DataMembers
.Add "BUDept"
.Add "Office"
End With
Class_Initialize_Exit:
Exit Sub
HandleError:
Err.Raise dsOperationFailed, "DBBUDept", "Recordset open failure"
End Sub
Every time I run the program, it reports the following:
Run-time error '-2147220990 (80040202)':
Recordset open failure
If anyone can help, I would appreciate it.
I am having trouble with the connection string in my data services tier. The code can be seen below:
Private Sub Class_Initialize()
'Create the Recordsets
On Error GoTo HandleError
Set conParthus = New ADODB.Connection
Set rsBUDept = New ADODB.Recordset
Set rsOffice = New ADODB.Recordset
'Open the Connection
conParthus.ConnectionString = "driver={SQL Server};" & _
"server=W98SYSREC;uid=;pwd=;database=Parthus;Trusted_Connection=Yes;"
conParthus.Open
Debug.Print "Connection1 successful"
'Open the rsBUDept Recordset
With rsBUDept
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "Select * from BUDepts", conParthus, , , adCmdText
End With
'Open the rsOffice Recordset
With rsOffice
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "Select OfficeID, OfficeName from Office", _
conParthus, , , adCmdText
End With
'Add Recordsets to the DataMembers collection
With DataMembers
.Add "BUDept"
.Add "Office"
End With
Class_Initialize_Exit:
Exit Sub
HandleError:
Err.Raise dsOperationFailed, "DBBUDept", "Recordset open failure"
End Sub
Every time I run the program, it reports the following:
Run-time error '-2147220990 (80040202)':
Recordset open failure
If anyone can help, I would appreciate it.