Showing posts with label duplicate. Show all posts
Showing posts with label duplicate. Show all posts

Friday, March 23, 2012

Multiple/Duplicate SQL Server Worker Processes

I don't even know where to begin looking... I have a page that loads multiple web user controls...
I know I use one connection object class that is used in all my objects when executing the query (calling Stored Procedures).
The problem is when the first page is rendered and each user control queries the database (SQL Server),
it eventually slows down. In my controls, I use a lot of repeaters and internal queries per each repeater item.
So I know it hits the database quite often.
Problem is when I look in SQL Server Enterprise Manager Process Info, I have multiple worker processes sleeping.
My first thought is ASP.net is creating a new session connection (process) to the SQL Server? Why? How?
What do I do to check either my code is creating the connection object properly. Thanks!
Larry
I have discovered, when I created my connection object for ExecuteNonQuery(), I forgot to Close() the connection.
Since I didn't close the connection object when I was finished... anda few new instances of the connection object was created, it created anew connection object.
In other functions, I was using the DataAdapter which opened and closedthe connection for you, so I took that feature for granted andcompletely forgot to close the connection object when doing aExecuteNonQuery().
I get a doht for the day...
Thanks for taking your time in reading...

Friday, March 9, 2012

multiple submit

Is there a way to stop duplicate entries into a database from people double clicking the submit button?You can use UNIQUE CONSTRAINTS for all columns not participating in a primary key.
See "Unique constraints" in BOL

Originally posted by rob7765
Is there a way to stop duplicate entries into a database from people double clicking the submit button?|||Although this could be handled on the DB side, I feel it's more appropriatly handled on the web-server side. Simplest is JS that disables a double-submit (Darn those mainframe people and their double-enter habbits).

For situations where you 100% of the time can't have double-submits, consider setting a hidden field & session variable that tracks if the user has submittted the form or not.

There is much discussion of this in forms dealing with the web side of life.

multiple submit

Is there a way to stop duplicate entries into a database from people double clicking the submit button?1. Beat them about the head and shoulders every time you catch them double clicking.

2. Put a unique index on the key column(s).

3. Add a trigger to prohibit inserting duplicate rows. Don't forget to have a nasty message!

4. Only allow modifications via stored procedures. By using a stored procedure you can do cool things like link to the payroll system and transfer $3.00 from their paycheck to yours everytime the double click.

5. Re-write your application so double clicks won't be a problem.|||I just posted a reply to a similar message. It was as general as, but as not witty as, Paul's response. I recomended solving it on the web side.