O código mantém o tempo limite excedido
Portanto, temos esse conjunto de códigos que, por algum motivo, continua atingindo o tempo limite. Não é o procedimento armazenado que está sendo executado, porque funciona bem. Além disso, se removermos o parâmetro do código c #, o código será executado. O parâmetro continua quebrando (causando o tempo limite) e não podemos descobrir o porquê.
c #:
public static PTWViewList GetList(int studynumber)
{
PTWViewList tempList = new PTWViewList();
using (SqlConnection myConnection = new SqlConnection(AppConfiguration.cnARDB))
{
string spName = "ardb.PTWViewSelect";
SqlCommand myCommand = new SqlCommand(spName, myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.AddWithValue("@study", studynumber);
myConnection.Open();
using (NullableDataReader myReader = new NullableDataReader(myCommand.ExecuteReader())) /*this is where the code times out*/
{
tempList = new PTWViewList();
while (myReader.Read())
{
tempList.Add(FillDataRecord(myReader));
}
myReader.Close();
}
}
tempList.ListCount = tempList.Count;
return tempList;
}
procedimento armazenado:
CREATE PROCEDURE [ardb].[PTWViewSelect]
@studynumber int = NULL,
@quoteid uniqueidentifier = NULL,
@lineitemid uniqueidentifier = NULL
AS
BEGIN
SET NOCOUNT ON;
SELECT
[Study]
,[LineItemID]
,[QuoteID]
,[Total]
,[COOP]
,[VendorCost]
,[CustCost]
,[LineItemNumber]
,[StudyTypeCode]
,[GroupLeader]
,[PTWDate]
,[PONumber]
,[POStatus]
,[StudyDirector]
,[SL_DESC_L]
,[SL_Code]
,ProjectDescription
,CreatedBy
,chARProcess
,CODate
FROM
[ARDB].[dbo].[PTWView]
WHERE
(@studynumber is null or StudyNumber=@studynumber)
AND (@quoteid is null or QuoteID=@quoteid)
AND (@lineitemid is null or LineItemID = @lineitemid)
END