SitePoint Sponsor |
|
User Tag List
Results 1 to 25 of 37
Thread: Duplicate Entries
-
Feb 27, 2007, 05:34 #1
Duplicate Entries
Hello Everyone,
I have a problem with Insert statement.
Though My SQL Statement executed once only, there are 2 records entered in DB.
I am using ASP and SQL Server.
Does anybody know the solution?Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Feb 27, 2007, 05:40 #2
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Without seeing the code and understanding the DB structure? No.
-
Feb 27, 2007, 06:05 #3
Sql Query Is As Follow:
logSQLQuery = "INSERT INTO ActivityLog (ActivityLogGUID, ActivityGUID, UserGUID, AnswerFlag) VALUES('" & ActivityLogGUID & "', '" & ActivityGUID & "', '" & Session("UserGUID") & "', " & Answer & ")"
Conn.Execute(logSQlQuery)
DB:
Table Name:ActivityLog
Columns:
ActivityLogGUID guid unique
ActivityGUID guid unique
UserGUID guid unique
AnswerFlag flag
Hope this will make sense to you...Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Feb 27, 2007, 09:12 #4
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Are any of those fields set as AutoNumber/AutoIncrement?
What happens if you try an equivalent hard-coded query in the MS SQL query manager?
-
Feb 27, 2007, 22:56 #5
Thanks for you kind response.
No fields are set to AutoNumber/AutoIncrement.
Following is the structure of my table.
Field Type
-----------------------------------------------
ActivityLogGUID uniqueIdentifier
ActivityDateTime getNow() - default value
ActivityGUID uniqueIdentifier
UserGUID uniqueIdentifier
AnswerFlag Bit
If I am entering query through Query Manager, only 1 record is entered.Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Feb 28, 2007, 08:44 #6
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If this action is being initiated by a <form>, make sure you are not submitting it twice (check any validation javascript)
-
Feb 28, 2007, 22:58 #7
No I have checked again that.
Form is submitting once only.
I have apply following trick also to check whether query is executed more than once.
Code:logSQLQuery = "INSERT INTO ActivityLog (ActivityLogGUID, ActivityGUID, UserGUID, AnswerFlag) VALUES('" & ActivityLogGUID & "', '" & ActivityGUID & "', '" & Session("UserGUID") & "', " & Answer & ")" Conn.Execute logSQLQuery Response.write logSQLQuery Response.End
So I am sure there is a problem with execution of Insert Query.
Is this a SQL Bug?Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 1, 2007, 09:09 #8
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is this a SQL Bug?
Post the entire ASP page and the page that contains the form you are submitting.
-
Mar 1, 2007, 23:24 #9
Hi Jim,
May I mail you the pages?Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 2, 2007, 13:22 #10
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PM me them please
-
Mar 2, 2007, 23:11 #11
Jim,
I am not able to attach the code im PM as code are so long and PM allow only 8192 characters.Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 9, 2007, 04:08 #12
Anybody have a chance to look at this??
Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 9, 2007, 07:43 #13
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
How about save the .asp page as .txt, upload it to your site, then PM us with the link or post the link here?
-
Mar 9, 2007, 22:52 #14
Siteguru,
May I mail you?Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 10, 2007, 06:21 #15
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
No. Just post a link or PM it.
-
Mar 11, 2007, 22:27 #16
I don't have a live site working currently and PM allow only 8192 characters.
That's why I am asking you to mail?Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 14, 2007, 08:26 #17
- Join Date
- Nov 1999
- Location
- Mechanicsburg, PA
- Posts
- 7,294
- Mentioned
- 123 Post(s)
- Tagged
- 1 Thread(s)
Just save it as a text file and post it in this thread as an attachment. That way everyone can get in on the conversation.
Dave Maxwell - Manage Your Site Team Leader
My favorite YouTube Video! | Star Wars, Dr Suess Style
Learn how to be ready for The Forums' Move to Discourse
-
Mar 15, 2007, 00:05 #18
Thanks Dave.
I never seen this option as I am using Quick Reply always.
I will post the code soon...Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 15, 2007, 00:06 #19
Both the pages are attached here...
Please help..Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 15, 2007, 05:31 #20
- Join Date
- Nov 1999
- Location
- Mechanicsburg, PA
- Posts
- 7,294
- Mentioned
- 123 Post(s)
- Tagged
- 1 Thread(s)
Hmmm. Nothing's jumping out that's glaringly wrong. the only thing I would think to try would be to get rid of the extraneous recordsets on the inserts
So
Set AnswerRS = Conn.Execute(SQLQuery)
Becomes
Conn.Execute SQLQuery
But that is only a performance saving - that shouldn't cause two hits to that insert statement.
Are you getting dups on every insert, or just that one table?Dave Maxwell - Manage Your Site Team Leader
My favorite YouTube Video! | Star Wars, Dr Suess Style
Learn how to be ready for The Forums' Move to Discourse
-
Mar 15, 2007, 06:34 #21Set AnswerRS = Conn.Execute(SQLQuery)
Becomes
Conn.Execute SQLQueryBest Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 15, 2007, 06:36 #22Are you getting dups on every insert, or just that one table?
I am getting this duplicate when queries submitted to this page only...Best Joomla Web Design and Development Agency :--:
PSD to Joomla :--: Award Winning Web Design Company
-
Mar 15, 2007, 07:13 #23
- Join Date
- Nov 1999
- Location
- Mechanicsburg, PA
- Posts
- 7,294
- Mentioned
- 123 Post(s)
- Tagged
- 1 Thread(s)
OK, but are the dups only to the ActivityLog table, or are you getting dups on the ActivityAnswers and ActivityMessages tables as well?
Dave Maxwell - Manage Your Site Team Leader
My favorite YouTube Video! | Star Wars, Dr Suess Style
Learn how to be ready for The Forums' Move to Discourse
-
Mar 15, 2007, 08:42 #24
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
There's a lot of javascript on that page, an ajax form submit function and a real form submit function, are you sure they're not both being called?
-
Mar 15, 2007, 23:21 #25Best Joomla Web Design and Development Agency :-
-:
PSD to Joomla :--: Award Winning Web Design Company
Bookmarks