Click here to Skip to main content
14,735,787 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to Resolve Time out Exception When Query take long Time

What I have tried:

I am Using Like Run procedure

_sql = "GetFinalResultFormula";
_parms = new SqlParameter[8];
_parms[0] = new SqlParameter("@ShiftID", SqlDbType.Int);
_parms[0].Value = shiftID == 0 ? null : (object)shiftID;
_parms[1] = new SqlParameter("@CourseID", SqlDbType.Int);
_parms[1].Value = courseID;
_parms[2] = new SqlParameter("@SpecializationID", SqlDbType.Int);
_parms[2].Value = specializationID;
_parms[3] = new SqlParameter("@InstituteID", SqlDbType.Int);
_parms[3].Value = instituteID;
_parms[4] = new SqlParameter("@SessionID", SqlDbType.Int);
_parms[4].Value = sessionID;
_parms[5] = new SqlParameter("@USERID", SqlDbType.Int);
_parms[5].Value = USERID;
_parms[6] = new SqlParameter("@EmpSubjectID", SqlDbType.Int);
_parms[6].Value = SubjectID;
_parms[7] = new SqlParameter("@pagenumber", SqlDbType.Int);
_parms[7].Value = pageno == 0 ? null : (object)pageno;

//_parms[7] = new SqlParameter("@FilterResultStatus", SqlDbType.Char);
//_parms[7].Value = FilterResultStatus == "(All)" ? null : (object)FilterResultStatus;
//_parms[8] = new SqlParameter("@FiltersubjectId", SqlDbType.Int);
//_parms[8].Value = Filtersubjectid == 0 ? null : (object)Filtersubjectid;

_dataSet = RunProcedure(_sql, _parms, true);
Updated 16-Mar-20 0:55am

1 solution

Well ... we can't say.
I'd start by looking at your SP, and what exactly it's doing - we can't do that because we have no access to your DB at all.
Perhaps using the SSMS Profiling tool to identify what part of it is taking time, and also establish now long the query takes to run.
When you have that, you can start looking at why, and either revising your DB and / or SP to run more efficiently, or changing the timeout so that you can get teh results if the query is necessarily complex and time consuming.

Sorry, but we can't do any of that for you!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

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