Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:40:12+00:00 2026-06-08T01:40:12+00:00

I have a Site which creates some form of a Report. The whole process

  • 0

I have a Site which creates some form of a Report. The whole process takes up to a Minute. To increase the performance I was thinking about turning the synchronous controller into a Asynchronous Controller.

I read through a lot of topics, and guides but I just don’t seem to get the hang of it.

Right now I have a DataSet which has ~15 DataTables. Each of the ~15 DataTables is filled by a different Query.

To convert this Page to a Asynchronous Controller i created a ConnectionManager, created 15 getMethods for each DataTable and each DataTable is in the Model. I also created 2 Controller – one called [Name]Async and one called [Name]Complete. However, now I am stuck.

How do I create ~15 Threads and assign each the Task to populate a DataTable with the getMethod?!

Here some parts of the Code.

Controller

public class RunTableStatisticsController : AsyncController
{
    public void RunTableStatisticsAsync()
    {
        AsyncManager.OutstandingOperations.Increment(2);

        // Create Threads who populate RunTableStatisticsModels DataTables
    }

    public ViewResult RunTableStatisticsComplete(RunTableStatisticsModel voModel)
    {
        return View(voModel);
    }
}

getMethod

public static DataTable getDataTable1()
        {
            try
            {
                DataTable dtTemp= new DataTable();
                dtTemp.Columns.Add(new DataColumn("ColumnName1", typeof(string)));
dtTemp.Columns.Add(new DataColumn("ColumnName2", typeof(string)));

                string sQuery = "select * from 1";

                // Instantiate the Command Object
                OleDbCommand dbCommand = new OleDbCommand(sQuery, ..MyConnectionManager.Connection);
                dbCommand.CommandType = CommandType.Text;

                // Execute the Stored Procedure
                OleDbDataReader dr = dbCommand.ExecuteReader();

                while (dr.Read())
                {
                    DataRow row = dtTemp.NewRow();
                    row["ColumnName1"] = dr["ColumnName1"]);
                    row["ColumnName2"] = dr["ColumnName2"];

                    dtTemp.Rows.Add(row);
                }
                return dtTemp;

            }

            catch (Exception ex)
            {
                throw new Exception("Error: Reading database.", ex);
            }
        }

Correspondend I do have in my Model

public DataTable dtTable1{ get; set; }

And then I have a View which has Telerik Grid Extensions which will be filled by the Data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:40:14+00:00Added an answer on June 8, 2026 at 1:40 am

    You could use the TPL to parallelize the retrieval of those DataTables. Here’s an example with 2, if you have more, you might consider using collections of DataTables:

    public class RunTableStatisticsController : AsyncController 
    {
        public void RunTableStatisticsAsync()
        {
            AsyncManager.OutstandingOperations.Increment(2);
    
            // Create tasks that populate RunTableStatisticsModels DataTables
    
            Task.Factory.StartNew(() =>
            {
                AsyncManager.Parameters["dt1"] = DAL.GetDataTable1();
                AsyncManager.OutstandingOperations.Decrement();
            });
    
            Task.Factory.StartNew(() =>
            {
                AsyncManager.Parameters["dt2"] = DAL.GetDataTable2();
                AsyncManager.OutstandingOperations.Decrement();
            });
        }
    
        public ViewResult RunTableStatisticsComplete(DataTable dt1, DataTable dt2)
        {
            var model = new RunTableStatisticsModel
            {
                DtTable1 = dt1,
                DtTable2 = dt2,
            };
            return View(model);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a publishing feature which creates some site columns, a content type
I have a couple of controllers on my site which are handling form data.
I have a site which relies heavily on javaScript. I created a mirror site,
I have created a web site which is valid to strict XHTML and passes
I need to create a WP site which will have multiple subjects. Each subject
When I have an Eclipse update site project, a site.xml file is created which
I have created an iframe which contains the label, powered by MyWebsite.site The iframe
I have a window application which uses SP classes to create a site. I
I have site which uses $(selector).load(path) function in more than 300 pages. Now my
I have a site which needs to be fully self-contained in the browser window,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.