You can call ANY method you wan using delegates:

public delegate int ExecuteNonQueryDelegate();

private void Foo()
{
        SqlConnection conn = new SqlConnection("some connection string");
        SqlCommand command = new SqlCommand("some stored procedure call");
        ExecuteNonQueryDelegate commandDelegate =
                new ExecuteNonQueryDelegate(command.ExecuteNonQuery);

        // Begin async processing
        IAsyncResult result = commandDelegate.BeginInvoke(null, null);

        // more processing

        // End async processing
        int i = commandDelegate.EndInvoke(result);
}


Hope that helps.

-----Mensaje original-----
De: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] En nombre 
de Brian Gaer
Enviado el: miércoles, 08 de octubre de 2003 1:09
Para: [EMAIL PROTECTED]
Asunto: [ADVANCED-DOTNET] Async Data Commands with ADO.Net

Is anyone familiar with a method to have an ADO.Net command object
perform a command.ExecuteNonQuery() asynchronously?



The Stored Proc I am calling takes from 2 to 10 minutes to return, and I
cannot wait for it and do not care what the results of the query are.
I searched all over and the only option I have found is creating a new
thread to make the database call.



Is there any other way that anyone is aware of?



Language: C#,

Database MSSQL Sever 2000

Using ADO.Net



Thank you,



Brian Gaer

[EMAIL PROTECTED]




===================================
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to