Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003

    Exclamation Unanswered: Inserting Record Twice using SP


    I'm using a Stored PRocedure in ASP to insert a record and get the IDENTITY back as an Output parameter to be used later in the ASP code.
    The problem is the code is inserting the record twice. Has anybody faced this problem before? IF yes, how to deal with it?

    Thanks in advance

  2. #2
    Join Date
    Feb 2002
    San Francisco, CA
    Post the code please so we can have a look

  3. #3
    Join Date
    Sep 2003
    Boston, MA

    Post It may be a more generic problem

    I've just run into the same problem, in a more fundamental way. In an ASP application, I was SELECTing an ADO recordset, then using .AddNew to ad a new record to the recordset, inserting some data, then using .UPDATE to save the record. About 50% of the time it randomly does a duplicate record. Then I created an INSERT statement to do the same thing, and also I get a random 50% or so duplicate records.

    I notice that what it does sometimes is change the last record of the recordset AND add a new record. That is to say, it loads the new records data into the last existing record (which it shouldn't do) and then also adds a new record and saves it as well.

    I think it's a clear generic problem with the INSERT function, which is what .AddNew calls.

    I've searched all over Microsoft's web site an the web in general, and can find nothing listed. I've just installed SP3a onto my installation of SQL Server 2000, running on Windows 2000 Server. I'll see what happens now. I was running SQL Server 2000 on NT 4.0 SP6a, and never had this problem. But I also didn't have this exact table/record structure or application running on it either.

    Please let me know if you find out a resolution, and I'll do likewise. I'm planning to send an email to Microsoft and contact a friend in Redmond.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts