我在下拉选择的索引更改事件中使用了以下存储过程。
create function get_timesheetentrydetails(tasktypeid int, projectbatchlotid int)
returns table (workpackageid integer, workpackagename varchar(500), taskid int, taskname varchar(500), taskdesc varchar(500), previoustaskid int,
previoustaskname varchar(500), previoustaskdesc varchar(500), esthrs numeric, empid varchar(200)) as $$
begin
return query select wp.id,wp.code,wp.taskid,t.name,t.description,wp.previoustaskid,t1.name as previoustaskname,t1.description as previoustaskdesc,
wp.estimatehours ,u.name
from workpackage wp
inner join task t on wp.taskid=t.id
inner join task t1 on wp.previoustaskid = t1.id
inner join userprofile u on wp.lastupdatedby = u.id
and wp.projectbatchlotid=$2 and t.tasktypeid=$1 and wp.status in ('TBA','inprocess')
and not exists (select id from timesheet where timesheet.workpackageid=wp.id and endtime is null);
end;
$$ language plpgsql;
在数据库服务器中,此过程在450ms内执行,但是当我从用户界面调用时,如果用户和数据的数量因执行而停止,则需要60秒。请告诉我你如何尽早解决这个问题。
以下代码在下拉列表中选择了索引更改事件。
ddlTask.Enabled = true;
DataTable dtbTasks = getTSTasks(rbnCurrentTask.SelectedItem.Value, ddlLotNo.SelectedItem.Value);
Master.bindDropDownList(ddlTask, dtbTasks, "taskdesc", "taskid");
// cascadeSelection(this, "ddlTask");
if (rbnCurrentTask.SelectedItem.Text == "Project Management")
{
DataTable dtb = getPMTasks();
Master.bindDropDownList(ddlTask, dtb, "taskcode", "taskid");
}
if (rbnCurrentTask.SelectedItem.Text == "Training")
{
DataTable dtbTraining = getTrainingTasks();
Master.bindDropDownList(ddlTask, dtbTraining, "taskcode", "taskid");
}