BeginExecuteNonQuery - call a procedure without waiting for it to complete

I am running a query in sql that takes many minutes to execute. I want to call the query from my website and the user should not have to wait for it to finish, i.e. as soon as he gives the command to execute the query he should be able to go to do somehting else on my website. I am trying to use BeginExecuteNonQuery.
With following code I do not call the pocedure. Do you know what I am doing wrong?

public void test_T1_Insert(string t1)
        SqlCommand command = new SqlCommand("test_T1_Insert", connection);
        command.CommandType = CommandType.StoredProcedure;

        command.Parameters.Add("@T1", SqlDbType.VarChar);
        command.Parameters[0].Value = t1;
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
Unfortunately the page must stay open until the query is completed.  You could utilize html frame with a hidden frame that can spawn iframes which runs these types of queries or you can utilize a run table with the SQL Server Agent which can then query the table and run the needed operation.  You can find more on this command and how it works here:
Scott PletcherSenior DBACommented:
You could also create a job to run the query, then start the job.  When you run sp_start_job, SQL just starts the job and returns immediately to the caller.  You can set the job to delete itself, to prevent jobs from building up in SQL Agent.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
johnson1Author Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.