Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Microsoft Cursor Engine
Message
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00647401
Message ID:
00647425
Views:
7
Be sure that your table have a primary key and that you retreive it in your recordset.


>I ave encountered an error when trying to update a recordset via ADO. It's source is the Microsoft Cursor Engine and says something to the effect that too many records existed to update. I am using the following syntax during the recordset update:
>
>Public Function PutRS(rs As ADODB.Recordset) As Boolean
>
> On Error GoTo LocalError
>
> PutRS = False
>
> If EmptyRS(rs) Then
> Exit Function
>
> ElseIf rs.LockType = adLockReadOnly Then
> Exit Function
>
> Else
> Dim cn As New ADODB.Connection
>
> With cn
> .ConnectionString = ConnectionString
> .CursorLocation = adUseServer
> .Open
> .BeginTrans
> End With
>
> With rs
> .ActiveConnection = cn
> .UpdateBatch
> cn.CommitTrans
> Set .ActiveConnection = Nothing
> End With
>
> cn.Close
>
> Set cn = Nothing
>
> End If
>
> PutRS = True
>
>Exit Function
>LocalError:
> Call ReportError(CStr(Now), CStr(Err.Number), CStr(Err.Description), CStr(Err.Source), "PutRS", True)
> If cn.State = adStateOpen Then
> cn.RollbackTrans
> cn.Close
> End If
> Set cn = Nothing
> PutRS = False
>End Function
>
>Does anyone have an idea? I am opening it with the following syntax:
>
>With rs
> .ActiveConnection = ConnectionString
> .CursorLocation = adUseClient
> .LockType = adLockOptimistic
> .CursorType = adOpenKeyset
> .Source = SQL
> .Open
> Set .ActiveConnection = Nothing
>End With
>
>Should I change anything about the way I open? The error only occurs when the recordset is sort of large. Does not occur on medium sized and smaller recordsets.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform