Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

In my application I am using a dataset and 4 methods like below.

Dataset ds=new Dataset();
ds=businesslogiclayerObject.method1(a,b,c,d);
ds=businesslogiclayerObject.method2(a,b,c,d,e);
ds=businesslogiclayerObject.method3(a,b,c,d,e,f);
ds=businesslogiclayerObject.method4(a,b,c,d,e,f,g,h);


Businee logic layer:

public Dataset method1(int a,string b...string d);
{
//used hash table object  to send parameternames and storedprocedure to DataAccess Layer.

}

same syntax for remaining 3 methods also.

(a,b,c,d,e,f,g,h) are the parameters to Stored Procedure in Businesslogic Layer. Till now I did not implement any threading concept so they are executing one by one.This takes lot of time to get result set in Dataset.

How can I execute above 4 methods at the same time?

Help me.

Regards,
N.SRIRAM
Posted
Updated 26-Jan-11 23:46pm
v2
Comments
m@dhu 27-Jan-11 5:46am    
Edited for code block
Sandeep Mewara 27-Jan-11 5:49am    
Instead of calling 4 methods, I would suggest you to handle it in SP at once!

Remember that your code is ASP.NET, so once your page finishes rendering, it will return to the user and it will not wait for your other threads to finish. As someone else said, you can make them one SP to cut time, you can also look to speed up your SQL if it's inefficient, improve your DB design if that's the issue, or if you don't care if the page goes back before the work is done, farm this work off to a service that does it without slowing your pages down.
 
Share this answer
 
In addition to what others said:

It appears that you are building using the same parameters.

ASM
ds=businesslogiclayerObject.method1(a,b,c,d);
ds=businesslogiclayerObject.method2(a,b,c,d,e);
ds=businesslogiclayerObject.method3(a,b,c,d,e,f);
ds=businesslogiclayerObject.method4(a,b,c,d,e,f,g,h);


your parameter is growing from a,b,c,d to a,b,c,d,e,f,g,h. well the first is a subset of the last. It is very hard to tell with out looking at the code, but do you have repreatitive code on all the methods? Can you re-factore the code, such that, fewer methods can do the work for you? may be all what you need is the last method and then refactor the work? But again very hard to tell without seeing the code.
 
Share this answer
 
You can use DataReader instead of DataSet.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900