Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 9th, 2007, 02:45 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default Fast and Efficient Async SQL Process

Hi All,
I would like to know the best way to use a SQL connection for a web site.
The situation is I have a one page site that has AJAX calls to update the GUI.
Each page page update writes one record to SQL 2000 and does not retrieve any data.
I would like to know the best approach to usitlise my connection to reduce the amount of time to open/close the connection and write the one record.
I feel as thought opening and closing the connection for each nonquery command is an overhead, is this the case?
How can i ensure that my commands are all executed in the least amount of time.
I have considered opening a connection leaving it open, locking the code to execute the command, is this a bad Idea?
Currently I have coded a static method to execute the commands
Code:
    public static void ExecuteTextNonQuery(string commandText)
    {
        SqlCommand cmd = new SqlCommand(commandText);
        cmd.CommandType = CommandType.Text;
        cmd.Connection = Connection;
        lock (connlock)
        {
            if (Connection.State != ConnectionState.Open) { Connection.Open(); }
            cmd.ExecuteNonQuery();
            Connection.Close();
        }
    }
Any advise or direction in this would be much appreciated.

Speed is the essence, I need to be able to serve this page to 1000's of concurrent users.

======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a new process to install SQL Server Exp tknnguyen C# 5 July 25th, 2008 03:24 AM
Registration Process for Sql Server 2000 tiyyob SQL Server 2000 3 May 9th, 2006 06:05 PM
Receive file via SOAP async dcrooks .NET Web Services 0 January 5th, 2005 04:15 PM
Efficient SQL Statement for Large Tables ritag SQL Server 2000 3 April 19th, 2004 11:03 AM



All times are GMT -4. The time now is 03:59 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.