| Author |
Topic |
|
trancetopia
Starting Member
4 Posts |
Posted - 2003-02-22 : 05:20:45
|
| Hi All,I hope someone can help me out there... Since last night, my SQL Server 2k has decided to insert two rows instead of one... I've searched the net for a solution but only found others who have the same problem but no resolution.Can anyone please advise with what to do or point me to a reference with the answer.Thanks-----Paulhttp://www.ulookingforme.com/forums |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-02-22 : 05:46:51
|
quote: Hi All,I hope someone can help me out there... Since last night, my SQL Server 2k has decided to insert two rows instead of one... I've searched the net for a solution but only found others who have the same problem but no resolution.Can anyone please advise with what to do or point me to a reference with the answer.Thanks-----Paulhttp://www.ulookingforme.com/forums
Can u please eloborate more on the problem?Expect the UnExpected |
 |
|
|
sherrer
64 Posts |
Posted - 2003-02-22 : 08:29:07
|
| Please post you insert query and an example table structure. |
 |
|
|
trancetopia
Starting Member
4 Posts |
Posted - 2003-02-23 : 04:46:40
|
Hi,Ok, this is the query im using to insert, its just a basic insert. Its being called from an asp page:quote: sqlParties = "INSERT INTO lan_parties (" &_ "[organizer], [partydate_start], [partydate_end], [totalplaces], [partytitle], [partydescription], [partylocation], [building], [cost]) VALUES ('" &_ sUsername & "','" &_ dtmStartdate & "','" &_ dtmEnddate & "'," &_ intAvailable & ",'" &_ strTitle & "','" &_ strDescription & "','" &_ strLocation & "','" &_ strVenue & "'," &_ intCost & ")"
And this is the table structure: This problem does not want to go away. As far as I know, it is only happening to this table. I have removed the table and rescripted it but it still double inserts.I've checked the page that inserts the data but the structure is fine.. I've even created a test page which only inserts into this table and again, it double inserts.I have no idea what is going on here... Hope you guys can help.Thanks,Paul![]() ![]() ![]() [url][/url]![]() ![]() ![]() -----Paulhttp://www.ulookingforme.com/forums |
 |
|
|
trancetopia
Starting Member
4 Posts |
Posted - 2003-02-23 : 07:30:14
|
| Hi,Ok i've sorted it..I was using <b>input type="image" onClick="javascript:this.form.submit()"</b> to post the form. For some unknown reason this was causing the double insert.. I changed this to a normal <b>input type="submit"</b> and the double insert problem has gone..Any idea why this would happen?-----Paulhttp://www.ulookingforme.com/forums |
 |
|
|
r937
Posting Yak Master
112 Posts |
Posted - 2003-02-23 : 11:02:02
|
| yeah, it happened because the onclick javascript action submitted the form, and then the fact that it's a submit button image also submitted the formi think you can fix it like this -- input type="image" onClick="javascript:this.form.submit(); return false"but note, i haven't tested this, because i would never use javascript to submit a form when there are perfectly good methods for submitting the form already availablerudyhttp://r937.com/ |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-02-23 : 11:14:21
|
| What if you want to do some validation before submission, instead of making a round-trip just to have to do it over again? |
 |
|
|
r937
Posting Yak Master
112 Posts |
Posted - 2003-02-23 : 17:08:08
|
| you talkin ta me, or trancetopia?do the validation in javascript, of coursebut instead of onclick on the submit button, use onsubmit on the form tagsee Forms & JavaScript Living Together in Harmony http://evolt.org/article/rating/17/28553/index.htmlrudy |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-02-23 : 17:18:06
|
ahhhhhh, makes sense. Thought you were dissin' JavaScript entirely. |
 |
|
|
|