Re: Jet and Batch Updates
From: Christoph Basedau (e_tonne_at_hotmail.com)
Date: 01/23/05
- Next message: Qwert: "Microsoft ActiveX Data Objects library, 2.5 vs 2.8"
- Previous message: Christoph Basedau: "Re: Mdac 2.8 & XP sp2 & Client Access"
- In reply to: Jared: "Jet and Batch Updates"
- Next in thread: Jared: "Re: Jet and Batch Updates"
- Reply: Jared: "Re: Jet and Batch Updates"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 23 Jan 2005 14:29:05 +0100
21.01.2005 18:05, Jared schrieb:
> I'm trying to use batch updating on a Jet database.
> I'm able to open a recordset with locktype=adlockbatchoptimistic.
> However, when I get to my second "AddNew" statement, I get an error message
> stating that the "Number of rows pending changes exceeds the limit".
This error occurs when the recordsets CurosrLocation is adUseServer,
which is default. If you change it to adUseClient, Jet supports
BatchUpdates.
> Does Jet support batch updating?
Works for me, See Testcode below
Private Sub Form_Load()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Set con = New Connection
With con
.CursorLocation = adUseClient
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.Properties("Data Source") = "C:\Data\db4.mdb"
.Open
End With
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient '<- necessary for BatchUpdate+Jet
.CursorType = adOpenStatic '<-only available cursor that supports updates
' if Location is clientside
.Source = "tb1"
.LockType = adLockBatchOptimistic
Set .ActiveConnection = con
.Open , , , , adCmdTable
End With
'# tb1 has 2 columns: PName(text) and PZip(long) and an autoID
rs.AddNew Array("PName", "PZip"), Array("Smith", 69115)
rs.AddNew Array("PName", "PZip"), Array("Miller", 10585)
rs.UpdateBatch ' <- if you comment out this line, new data will be
' available in the rcordset only, but not in the database
rs.Requery 'Requery data from source
AutoRedraw = True
Print rs.GetString
End Sub
-- Gruesse, Christoph Rio Riay Riayo - Gordon Sumner, 1979
- Next message: Qwert: "Microsoft ActiveX Data Objects library, 2.5 vs 2.8"
- Previous message: Christoph Basedau: "Re: Mdac 2.8 & XP sp2 & Client Access"
- In reply to: Jared: "Jet and Batch Updates"
- Next in thread: Jared: "Re: Jet and Batch Updates"
- Reply: Jared: "Re: Jet and Batch Updates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|