Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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
  #1 (permalink)  
Old February 24th, 2005, 01:37 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default Recordset delete question/problem

My question is this...

In the code below my first sql statement updates a table.

my second then grabs all data from that table and chooses the ones that are "deactivated"

I am then inserting those "deactivated" records into a new table.

I want to delete the deactivated data from the first table. can I use the same recordset that I used for the previous insert or do I have to create a new recordset?

here is the code.....SQL Server by the way...

deaID = request("deaID")

    sql = "update dealerships set dactive=0 where deaID=" & deaID
    set deldealer = conn.execute(sql)


    sql2 = "SELECT * FROM dealerships WHERE dactive=0"
    set rs = conn.execute(sql2)


    DO While not rs.eof
        sql3 = "INSERT INTO inactivedealerships (Blah, blah, blah) VALUES ("BLAH, BLAH, BLAH")"


        set rs2 = conn.execute(sql3)
        rs2.MoveNext
    loop

  #2 (permalink)  
Old February 25th, 2005, 07:50 AM
Authorized User
 
Join Date: Aug 2004
Location: Calicut, Kerala, India.
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe you mind if I rewrite the code for you
deaID = request("deaID")

    sql = "update dealerships set dactive=0 where deaID=" & deaID
    set deldealer = conn.execute(sql)


    sql2 = "SELECT * FROM dealerships WHERE dactive=0"
    set rs = conn.execute(sql2)


    DO While not rs.eof
        sql3 = "INSERT INTO inactivedealerships (Blah, blah, blah) VALUES ("BLAH, BLAH, BLAH")"


        conn.execute(sql3)


        rs.MoveNext
    loop
conn.execute("Delete FROM dealerships WHERE dactive=0")


Shibu Narayanan
Software Associates


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select and Recordset question iacon Beginning VB 6 4 June 24th, 2006 09:37 AM
Recordset Update question smarks Classic ASP Databases 2 March 14th, 2005 03:57 AM
Question regarding recordset emachines Access VBA 3 March 3rd, 2005 08:52 AM
Delete a column from an ADO recordset. madkaikar_ashish Classic ASP Professional 1 September 11th, 2004 09:26 AM
a question about Delete in richEdit Fahima VS.NET 2002/2003 0 April 1st, 2004 06:34 PM





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