|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi guys,
I experienceing a really weird bug at the moment. When I perform an insert, 2 records get added! (PS - I am using an ASP web interface.) Both records are identical, except for their key (incrementing INT's), obviously. I am using the same bit of code I always use successfully everywhere else. I've gone over everything, but I can find no trace of an extra execute statement or anything anywhere... Anyone else experienced this before, or any ideas on what could be causing this?? thanks, craig |
|
#2
|
|||
|
|||
|
are u using sql server 2000 ? if so use profiler to check that ur asp page isn't inserting the record 2 times.
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#3
|
|||
|
|||
|
hmm, if i were you, try commenting out the line that inserts the records, and run the script, if it still adds a record, then your got another query somewhere?
|
|
#4
|
||||
|
||||
|
Agghhhhh
figured it out...
<input type="image" onclick="document.frmDetails.submit()"> is the culprit. By default the IMAGE INPUT type is a submit button. I also had code in the onclick attribute submitting the form. Two submits!!!!! what a bugger |
|
#5
|
|||
|
|||
|
Weird SQL bug - INSERT adds 2 records
I just started to experience the same problem. I looked over the code and don't find anything wrong.
I have had the same exact code for 2 years with no problem. |
|
#6
|
|||
|
|||
|
i have use the profiler.. i can see the statement is executed 2 times..
how to rectify this ? |
|
#7
|
||||
|
||||
|
Show us the code you are using to execute the statement (and the form) - maybe it's being submitted twice like mine was.
|
|
#8
|
|||
|
|||
|
i attached the code
GR_RecPartsPopupUpdate
- insert statement is here GR_RecPartsPopup.zip - 20 rows of entry with check box for each one.. - only checked entry will be inserted to database |
|
#9
|
||||
|
||||
|
Your counter checkbox doesn't seem to set to the value "on". Your popupupdate code only runs on rows that are checked. Does that sound right?
|
|
#10
|
|||
|
|||
|
checkbox setup
yeap.. it is true
|
|
#11
|
|||
|
|||
|
solution
so do u have any solution for this ?
|
|
#12
|
||||
|
||||
|
Um - yes, add 'value="on"' (without the single quotes) into your checkbox.
|
|
#13
|
|||
|
|||
|
Quote:
already add value=on. but the same error happen again |
|
#14
|
|||
|
|||
|
weird problem
the first page if i click received parts that link to second page (update page)
and when first time update it will insert two times but after first time update, on the same page (second page) i click refresh button it will insert 1 time |
|
#15
|
|||
|
|||
|
sql profiler
i am using profiler to check the updating process
when come to first page i click the received part button that link to second page.. and on second page if i update the parts it will insert twice and when i continue on the same page i click refresh button it will insert one time.. in the profiler i noticed that the first update on second page the insert statement running smoothly but after the last record inserted it display Event Class - RPC:Completed TextData - exec sp_reset_connection then it perform the same insert statement again.. but when i click the refresh button the profiler shows only once the insert statement without the event class and textdata as i mentioned (RPC:Completed, exec_sp_reset_connection can anyone help me on this problem ? i just wan the data to be inserted one time only |
|
#16
|
||||
|
||||
|
Figured it out! - it's essentially the same problem as I was having. The form is being submitted twice.
Change your validation function so that it only returns true, and does NOT submit the form. That's what the submit button is for. ![]() |
|
#17
|
|||
|
|||
|
exec sp_reset_connection
exec sp_reset_connection
what is this means ? |
|
#18
|
|
|
|