Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 2nd, 2004, 12:07 PM
Authorized User
 
Join Date: Oct 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO DELETE METHOD

Hi , having trouble using the delete method on an ADODB.recordet
having deleted a record i need to alter one of the fields in all the records after the deleted record. Here the code:


rstbatch.Open strBatchTableName, adoConBatch, adOpenKeyset, adLockOptimistic, adCmdTable

rstbatch.movenext
rstbatch.movenext
With rstbatch
            If Not (.BOF And .EOF) Then
                On Error Resume Next
                intRecNum = .Fields("Record_Number")
                oldRecNum = .Fields("Record_Number")
                .Delete
                If Err.Number = 3021 Then
                    .MoveLast
                    .Delete
                Else
                    .MoveNext
                    If .EOF Then
                        .MoveLast
                        VarBookmark = .Bookmark
                    Else
                        Do Until .EOF
                            .Fields("Record_Number") = intRecNum
                            .Update
                            If intRecNum = oldRecNum Then
                                If .EOF Then
                                    .MoveLast
                                    VarBookmark = .Bookmark
                                    Exit Do
                                End If
                            End If
                            intRecNum = intRecNum + 1
                            .MoveNext
                        Loop
                    End If
                End If
            .Bookmark = VarBookmark
            End If
        End With

 
Old November 2nd, 2004, 07:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

This is SQL server forum, you got to post that on a relavant forum as I could see that dealing with ASP. Not everyone would like to see an ASP related post here on this forum. Also you can delete the other post that you posted here on the same forum with the same topic and content.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old November 3rd, 2004, 05:07 AM
Authorized User
 
Join Date: Oct 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no its not asp...the code is VB6...and i amd using msde 2000 so therefore i have posted it here


 
Old November 3rd, 2004, 06:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In that case, you're still better off posting this in a VB forum. This SQL forum is meant for stuff directly related to SQL Server, while your question seems to deal with VB and ADO.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 4th, 2004, 04:58 AM
Authorized User
 
Join Date: Oct 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok well i sorted it myself...thanks for the advice






Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Find Method of ADO martinaccess Access 3 November 21st, 2007 07:35 AM
NextRecordset method in ADO.NET? Clay ADO.NET 6 April 20th, 2005 07:54 AM
Delete a column from an ADO recordset. madkaikar_ashish Classic ASP Professional 1 September 11th, 2004 09:26 AM
How to use the DELETE method in a DataSet thomaz C# 2 January 10th, 2004 02:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.