
How to access RDO with VB 5.0 and MS SQL Server 5.0
How do you do updates using VB 5.0 using RDO to SQL Server 6.5 and transaction processing.
I know that with DAO I do the following....
____________________________
workspace.BeginTransaction
do until stop
recordset.Edit
some field here to edit
recordset.update
loop
workspace.committrans
____________________________
Here are the steps I have for rdo. Please correct as necessary...
____________________________
Step 1: A Connectioni established using this connect string
("UID=a;PWD=b;DATABASE=c;SERVER=e;DRIVER={SQL SERVER};DSN='';") and the following function called
Connect.....The function resides in an ACTIVE X DLL
Public Function Connect(sConnect As String) As Boolean
Dim TimeExpected As Single
Dim Ts As Single, Tn As Single
On Error GoTo ConnectError
TimeExpected = 15
Connect = True
Set cn = New rdoConnection
With cn
.Connect = sConnect
.CursorDriver = rdUseServer
.EstablishConnection rdDriverNoPrompt, False, rdAsyncEnable
.QueryTimeout = 0
DoEvents
While .StillConnecting
Tn = Int(Timer - Ts)
If Tn < TimeExpected Then
Else
TimeExpected = TimeExpected + 10
End If
DoEvents
Wend
End With
Exit Function
ConnectError:
Dim merror As rdoerror
For Each merror In rdoEngine.rdoErrors
With merror
MsgBox .Number & " " & .Description, vbCritical, "clsAdmin connect error"
End With
Next merror
Connect = False
End Function
Step 2: An updateable RDO resultset is created using the following code....(this is a fragment
only). CParams is a collection that is passed into this fragment.
For x = 1 To CParams.Count
If CParams.Item(x) = CParams.Item("SqlString") Then
'Set rs = cn.OpenResultset(CParams.Item(x), rdOpenDynamic, rdConcurLock,
rdExecDirect)
Set rs = cn.OpenResultset(CParams.Item(x), rdOpenKeyset, rdConcurLock,
rdExecDirect)
End If
Next
____________________________
Lawrence M. Seldin, CMC, CPC
Author of POWER TIPS FOR THE APPLE NEWTON and INTRODUCTION TO CSP
http://www.*-*-*.com/