problem with ADODataControl.Recordset.Delete

problem with ADODataControl.Recordset.Delete

Post by J. J. Ca » Sat, 05 Jun 1999 04:00:00



Hi, there,

I have a problem with the ado data control's recordset delete method: when I
try to delete a record using the following code,
            With datTest.Recordset
                    .Delete
                    .MoveNext
                    If .EOF Then
                        .MoveLast
                    End If
             End With
I got the message: -2147217887 Errors occurred. But, when you just load the
form and do the delete, it usually works fine. Only after you move the
recordset few times, then you have the problem.

Where datTest is an ADO data control with the setting:

    strConnection = "Provider=MSDAORA.1;Password=Test;User ID=Test;" & _
                    "Data Source=oracle;Persist Security Info=True"
    strTable = "TEST"
    strSQL = "SELECT * FROM " & strTable

    With datTest
        .LockType = adLockOptimistic
        .CursorType = adOpenDynamic
        .CursorLocation = adUseClient
        .ConnectionString = strConnection
        .RecordSource = strSQL
        .Refresh
        With .Recordset
            If .RecordCount > 0 Then
                .MoveLast
                .MoveFirst
            End If
        End With
    End With

in the form load event.

Can anybody help me?


 
 
 

problem with ADODataControl.Recordset.Delete

Post by Suzanna Wil » Tue, 08 Jun 1999 04:00:00


Try this:
            With datTest.recordset
                .Delete
                If .EOF <> True Then
                    .MoveNext
                Else
                    .MoveLast
                End If
            End With
I think you may be getting the error because you test for EOF after you
attempt to MoveNext. HTH.


>Hi, there,

>I have a problem with the ado data control's recordset delete method: when
I
>try to delete a record using the following code,
>            With datTest.Recordset
>                    .Delete
>                    .MoveNext
>                    If .EOF Then
>                        .MoveLast
>                    End If
>             End With
>I got the message: -2147217887 Errors occurred. But, when you just load the
>form and do the delete, it usually works fine. Only after you move the
>recordset few times, then you have the problem.

>Where datTest is an ADO data control with the setting:

>    strConnection = "Provider=MSDAORA.1;Password=Test;User ID=Test;" & _
>                    "Data Source=oracle;Persist Security Info=True"
>    strTable = "TEST"
>    strSQL = "SELECT * FROM " & strTable

>    With datTest
>        .LockType = adLockOptimistic
>        .CursorType = adOpenDynamic
>        .CursorLocation = adUseClient
>        .ConnectionString = strConnection
>        .RecordSource = strSQL
>        .Refresh
>        With .Recordset
>            If .RecordCount > 0 Then
>                .MoveLast
>                .MoveFirst
>            End If
>        End With
>    End With

>in the form load event.

>Can anybody help me?




 
 
 

problem with ADODataControl.Recordset.Delete

Post by J. J. Ca » Tue, 08 Jun 1999 04:00:00


Hi, there,

Thanks a lot for the suggestion. I tried what you suggested. However, it
still does not work.
Indeed, the error occurred at the line: .Delet. It does not get that far to
the line .MoveNext.

Thanks for the help. If you have any other suggestions, please let me know


> Try this:
>             With datTest.recordset
>                 .Delete
>                 If .EOF <> True Then
>                     .MoveNext
>                 Else
>                     .MoveLast
>                 End If
>             End With
> I think you may be getting the error because you test for EOF after you
> attempt to MoveNext. HTH.


> >Hi, there,

> >I have a problem with the ado data control's recordset delete method:
when
> I
> >try to delete a record using the following code,
> >            With datTest.Recordset
> >                    .Delete
> >                    .MoveNext
> >                    If .EOF Then
> >                        .MoveLast
> >                    End If
> >             End With
> >I got the message: -2147217887 Errors occurred. But, when you just load
the
> >form and do the delete, it usually works fine. Only after you move the
> >recordset few times, then you have the problem.

> >Where datTest is an ADO data control with the setting:

> >    strConnection = "Provider=MSDAORA.1;Password=Test;User ID=Test;" & _
> >                    "Data Source=oracle;Persist Security Info=True"
> >    strTable = "TEST"
> >    strSQL = "SELECT * FROM " & strTable

> >    With datTest
> >        .LockType = adLockOptimistic
> >        .CursorType = adOpenDynamic
> >        .CursorLocation = adUseClient
> >        .ConnectionString = strConnection
> >        .RecordSource = strSQL
> >        .Refresh
> >        With .Recordset
> >            If .RecordCount > 0 Then
> >                .MoveLast
> >                .MoveFirst
> >            End If
> >        End With
> >    End With

> >in the form load event.

> >Can anybody help me?