By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,974 Members | 1,913 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,974 IT Pros & Developers. It's quick & easy.

Help with Asynchronous implementation of my method

P: n/a
I have a requirement/standard that we must use the Enterprise Library Data
class to implement our Database transactions for our public website such as
inserting data, etc.

So, with that, I have a method below which uses some methods from
Enterprise.Data. I need to call and run this method asynchronously so that
it doesn't bog down our website because this insert will happen on every
search that the users make on our website. We are recording search terms in
our database table.

There is no exceptions here, I must use the line below that calls my stored
proc to do the inserts.

How can I call this method asynchronously?

I have looked at BackGroundWorker and I'd really like to use it, but
everyone seems to show examples of it in Windows Forms, not an ASP.NET web
application. Can it be used? How would I do a simple call to my method with
it...no need to return anything from the database, just eat the thread after
it's done.

Here's my code. If there is another way let me know also to implement my
existing Method (without tampering my line that does the insert...and no, I
can't just scrap it and use something like BeginExecuteNonQuery becauase the
requirement is to use the EL implementation
DatabaseFactory.CreateDatabase().ExecuteNonQuery.

How can I make this insert Asynchronous by somehow calling my method and
having it perform its processing on another thread?

Again, if you can verify that I can do this with BackGroundWorker, I'd love
to, just not sure how:

public static void InsertSearchTerm(string SearchTerm)
{
DateTime CreateDate = DateTime.Now;
Int32 ResultCount = 1;

try
{

DatabaseFactory.CreateDatabase().ExecuteNonQuery(" myinsert_proc", SearchTerm,
ResultCount, CreateDate);
}
catch
{
throw;
}
--
dba123
Jul 26 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.