Try using SqlCommand to do the work, instead of SqlDataSource.
Main Topics
Browse All Topicsin the code section below i've pasted the way i do all of my SQL insert's updates and deletes. i'm entirely self taught and just sort of pick up habits where i find them, so please excuse my ignorance if this is a silly question that you feel all should know.
basically, i have a really large site and this is the code i put behind buttons to do things with the database when user's click. my issue is that i run into plenty of instances where a button click will take a really long time to compelte, even though i'm watching my server's task manager and resources and they're all very low usage and wouldn't explain the delays. it's very random, sometimes buttons run fast, sometimes they don't.
another problem is that if i have a page that may have many user clicks on the same page (like a inbox, where users are deleting messages) it seems to get clogged after a few button clicks, not succesfully performing the SQL commands for all button clicks after the second or third.
i'll also fairly routinely get javascript alert box errors in my browser if i try to navigate away from the page i've just button clicked, if the SQL behind it hasn't completed. this is all very ugly obviously.
it's recently occurred to me that maybe there's just a better way of performing SQL commands so i thought i'd ask you guys. please keep your answers dumbed down, i'm very novice and just learning as i go.
any ideas? thanks in advance for any help. i work in asp.net c# mssql2005 windows server 2003
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
got this error trying your code
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'System.Data.SqlClient.Sql
Source Error:
Line 216: string strConn = ConfigurationManager.Conne
Line 217: SqlConnection conn = new SqlConnection(strConn);
Line 218: SqlCommand cmd = new SqlCommand(conn);
Change
SqlCommand cmd = new SqlCommand(conn);
To:
SqlCom
cmd.Connectio
catch (Exception e)
{
throw (e);
}
basically catch the exception then re-throw this exception in case you have a centralized place to handle all exception errors. You can change it to something like this:
catch (Exception e)
{
//handle the exception locally.
}
Business Accounts
Answer for Membership
by: carlnorrbomPosted on 2009-08-03 at 13:16:09ID: 25008250
Hi,
en-us/maga zine/cc163 725.aspx
In Your case I would suggest abstracting the data access methods into it's own class and spawn it into a separate thread for instance if the updates are taking a long time to complete, freing up the UI and making the user experience better. I would suggest looking into "Asynchronous Pages" for instance:
http://msdn.microsoft.com/
/Carl.