|
-
Mar 7th, 2001, 11:16 AM
#1
Thread Starter
New Member
I try to update the DB with the contains of rs2.
rs2 as been updated in my "business service" and i want to update the DB
rs2 is a recordset from my table Participant.
Some one can help me ?
Private Sub MAJ_DS()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim sSQL As String
Dim sConnectionString As String
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
sConnectionString = cgsConnectionString & " Source=" &
"E:\F1\Data\F1.mdb"
cn.Open sConnectionString
rs.Open "Select * From Participant", cn, adOpenDynamic,
adLockBatchOptimistic
rs2.Open "e:\test.xml"
Set rs = rs2 ??
rs.UpdateBatch ??
End Sub
-
Mar 7th, 2001, 01:13 PM
#2
Thread Starter
New Member
I found the answer myself
Private Sub abd()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim sSQL As String
Dim sConnectionString As String
Dim strXML As String
Dim os As ADODB.Stream
Dim os2 As ADODB.Stream
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
Set os = New ADODB.Stream
Set os2 = New ADODB.Stream
sSQL = "Select * From Participant"
sConnectionString = cgsConnectionString & " Source=" & "E:\F1\Data\F1.mdb"
cn.CursorLocation = adUseClient
cn.Open sConnectionString
rs.Open sSQL, cn, adOpenKeyset, adLockBatchOptimistic
rs.Save os, adPersistXML
rs.Close
Set rs = Nothing
strXML = os.ReadText(adReadAll)
os2.Open
os2.WriteText strXML
os2.Position = 0 'Set the stream position to the start
rs2.Open os2
os2.Close
Set os2 = Nothing
rs2.ActiveConnection = cn
While Not rs2.EOF
rs2.Fields("Adresse") = CStr(Time) & "123 Mont"
rs2.Update
rs2.MoveNext
Wend
rs2.ActiveConnection = cn
rs2.UpdateBatch adAffectAllChapters
rs2.Close
Set rs2 = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|