Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:51 AM.


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