Skip to main content
Inspiring
May 11, 2007
Question

Inserts the same row twice into database??

  • May 11, 2007
  • 2 replies
  • 275 views
I know this may be a tough one without more information but I just wondered
if anyone had come accross anything similar:

I have an asp page that triggers a SQL stored procedure which performs an
insert into the DB. This works or rather worked fine but now it makes a
double insert into the database! So, instead of writing 1 record to the
database it writes 2 identical ones (except for the PK column of course).

I have tried for my life to figure out why but cannot see a reason. I would
post the code but it is 1300 lines long. The Stored Proc is fine, nothing
obvious in the ASP.......I am at a loss.

Has anyone else come accross this before?


This topic has been closed for replies.

2 replies

Inspiring
May 12, 2007
The first thing to look at is the timestamps of the records. Are they the
same, or spaced apart. It could be that one record is inserted when the page
loads and another on postback of the form.

The next technique to use is logical deduction with Response.End(). Put
Response.End at the beginning of the code and run the page. It's likely that
no records will be inserted. Next, move the code to the bottom of the page.
It's likely now that 2 records will be inserted. So, by logical deduction,
the problem lies somewhere in between. Next, move Response.End to the middle
of the code. What happens? 0, 1 or 2 records inserted. Using that
information you can then move the Response.End to other positions and
isolate where the problem lies.

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004


Inspiring
May 12, 2007
Without seeing the code, it's pretty tough to analyze .. are you somehow
doubling the insert?


--
Nancy Gill
Adobe Community Expert
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner''s
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development

"Del Pierce" <com@com.com> wrote in message
news:f22vp0$5jb$1@forums.macromedia.com...
>I know this may be a tough one without more information but I just wondered
>if anyone had come accross anything similar:
>
> I have an asp page that triggers a SQL stored procedure which performs an
> insert into the DB. This works or rather worked fine but now it makes a
> double insert into the database! So, instead of writing 1 record to the
> database it writes 2 identical ones (except for the PK column of course).
>
> I have tried for my life to figure out why but cannot see a reason. I
> would post the code but it is 1300 lines long. The Stored Proc is fine,
> nothing obvious in the ASP.......I am at a loss.
>
> Has anyone else come accross this before?
>