Hi to Everyone,
My Scenario:
I will get some set of datas from two stored procedure. I will store first stored procedures data into datasetA. And data of second Stored procedure will be stored in datasetB. i have an another common datasetC. On that DatasetC i am going to merge these two datasets.
After Merging the Datasets i have to show in Gridview.
Now my Problem is,
I have to run those two stored procedures at a same time using threadstart(threading).
First Stored Procedure has a time delay of 8sec, and second SP has a time delay of 3 sec,
I need to fill the grid view when the second one got finished and it has to wait for the first stored procedure, After First Sp got finished it needs to merge with second one and it have to shown in grid view.
please help me to get clear out of this.
For your Kind Reference:
First Stored Procedure
Create procedure Athread
as
begin
WAITFOR DELAY '00:00:08'
select * from area where areaname LIKE 'C%';
end
Second Stored Procedure
Create procedure Bthread
as
begin
WAITFOR DELAY '00:00:03'
select * from area where areaname LIKE 'F%';
end
I am Calling the below code in an Button Event
Thread thread1 = new Thread(new ThreadStart(Athread));
Thread thread2 = new Thread(new ThreadStart(Bthread));
thread1.Start();
thread2.Start();
I am Having two Functions to call these Sp and two display in Grid view
dataset dsA;
dataset dsB;
dataset dsCommon;
public void Athread()
{
dsA = ExecSP("Athread");
if (dsA.Tables[0].Rows.Count > 0)
{
dsCommon.Merge(dsA);
gvthread.DataSource = dsCommon;
gvthread.DataBind();
}
return;
}
public void Bthread()
{
dsB = ExecSP("Bthread");
if (dsB.Tables[0].Rows.Count > 0)
{
dsCommon.Merge(dsB);
gvthread.DataSource = dsCommon;
gvthread.DataBind();
}
return;
}
Please help me in Threading and to finish this...