Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2007, 03:45 AM
Friend of Wrox
 
Join Date: Jun 2003
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
======================================





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 05:15 PM
Efficient SQL Statement for Large Tables ritag SQL Server 2000 3 April 19th, 2004 11:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.