Re: Jet and Batch Updates
From: Jared (Jared_at_discussions.microsoft.com)
Date: 01/24/05
- Next message: SomeoneKnows: "Adding records to Oracle using VB6 class"
- Previous message: Qwert: "Re: Microsoft ActiveX Data Objects library, 2.5 vs 2.8"
- In reply to: Christoph Basedau: "Re: Jet and Batch Updates"
- Next in thread: Christoph Basedau: "Re: Jet and Batch Updates"
- Reply: Christoph Basedau: "Re: Jet and Batch Updates"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 Jan 2005 06:17:10 -0800
You were right!
"Christoph Basedau" wrote:
> 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: SomeoneKnows: "Adding records to Oracle using VB6 class"
- Previous message: Qwert: "Re: Microsoft ActiveX Data Objects library, 2.5 vs 2.8"
- In reply to: Christoph Basedau: "Re: Jet and Batch Updates"
- Next in thread: Christoph Basedau: "Re: Jet and Batch Updates"
- Reply: Christoph Basedau: "Re: Jet and Batch Updates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|