But what's wrong with creating a thread? If you use the threadpool it's
almost a one-liner! (Aside from the stub you'll prob have to write..)
I guess it's personal preference whether you prefer to use special async
APIs or whether you prefer fns that block until complete -- I personally
avoid async APIs like the plague - they split my code into two parts - a
caller and an event handler, which I find harder to manage (and which
reminds me of the Win16 message model ;) ).
For example:
void SomeFunc()
{
LengthyTaskA();
LengthyTaskB();
}
versus:
void SomeFuncStart()
{
LengthyTaskA_Start(new [delegate to OnLengthyTaskAComplete]);
}
void OnLengthyTaskAComplete()
{
LengthyTaskB_Start();
}
Even if I don't care about the result of the call or when it finishes I
generally do not use async APIs because I like to be responsible for the
lifetime of the threads in my app (or have that option in the future.)
Jade Burton
-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Brian Gaer
Sent: Wednesday, 8 October 2003 9:09 AM
To: [EMAIL PROTECTED]
Subject: [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 message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
--
This message has been scanned for viruses and dangerous content by MailScanner, and is
believed to be clean.
===================================
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