1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2008
    Rep Power

    Insert Records in recordset while loop

    Hello All,

    I am attempting to insert records when in a recordset while loop.

    To start, I am querying for records off of one id and from that recordset I want to insert values returned from recordset under a new ID. However, when I execute I get a 500 internal server error.

    I have done some brute force debugging and the recordset is returning values.

    Here is my code:
    SQLQueryProducts="SELECT ProdId, CostOfProd, HourlyRate, OrdWay FROM CustProdLink WHERE CustId='" & request("DuplicateForm") & "'"
    set rs=Server.CreateObject("Adodb.RecordSet") 
    rs.open SQLQueryProducts, adoCon 
    do while not rs.EOF
       strSQL = "INSERT INTO ProdCustLink (CustId, ProdId, CostOfProd, hourlyRate, OrdWay) VALUES('" & request("custID") & "', '" & rs("ProdId").Value & "', '" & rs("CostOfProd").Value & "', '" & rs("hourlyRate").Value & "', '" & rs("OrdWay").Value & "')" 
      adoCon.execute strSQL 
    set adoCon=nothing
    Thanks in advance!

    - Jesse
  2. #2
  3. KIS
    ASP Hero (2000 - 2499 posts)

    Join Date
    Jul 2007
    Rep Power
    what is the error? not the generic 500....

    if using internet explorer

    tools>internet options>advanced>browsing>show friendly http error messages(UNCHECK THIS OPTION)>ok

    try your page again...hopefully an error number/description comes up

    if so...tell us what line...and message

    Comments on this post

    • micky agrees
    Last edited by keep_it_simple; October 7th, 2008 at 11:31 PM. Reason: removed guess
    Please give respect to those that helped solve an issue by clicking on the reputation icon
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2008
    Rep Power
    Thanks for the info, completely forgot about turning off friendly HTTP errors.

    I fixed it... make sure you use the right table name! Ugh, I can't believe that's the one thing I skipped.

    Thanks again!

    - Jesse

Similar Threads

  1. Insert Records from select query into table
    By ShannyFE in forum Microsoft SQL Server
    Replies: 2
    Last Post: June 24th, 2006, 05:23 AM
  2. Replies: 2
    Last Post: May 5th, 2006, 09:58 AM
  3. Insert records
    By dasphatman in forum ASP Development
    Replies: 21
    Last Post: May 30th, 2005, 02:03 PM
  4. Insert Records Access DB
    By jamesh in forum ASP Development
    Replies: 2
    Last Post: March 5th, 2005, 04:58 PM
  5. Replies: 10
    Last Post: March 29th, 2004, 03:10 PM

IMN logo majestic logo threadwatch logo seochat tools logo