Buenas al Grupo,
Tengo una aplicacion que me gener el siguiente error:
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding
Esto ocurre cuando trato de desplegar una lista que me devuelve un SP, y
pongo en un DataReader desde una aplicacion Web.
El Query que esta dentro del Stored Procedures es este:
SELECT NumeroOrigen, NumeroDestino, Fecha, Hora,
(SELECT MAX(CodigoArea)
FROM Destino
WHERE CodigoArea = SUBSTRING(NumeroDestino,
1, LEN(CodigoArea))) AS PrefijoDestino
FROM dbo.LLDate
Este Query lo que hace es darme una tabla la cual me da un Campo
"PrefijoDestino", este campo me devuelve solo una parte del numero sacando
el maximo en la tabla de Destinos.
Como son llamadas telefonicas hay muchos registros pueden estar en el orden
de los 250,000 y mas.
Aqui va el codigo
Public Class Class_Reportes
Dim objCnn As New Class_Conexion
Dim _IfError As Boolean
Dim _ErrMsg As String
Public Function Reporte(ByVal FechaIni As Integer, ByVal FechaFin As
Integer, ByVal Cnn As SqlConnection) As SqlDataReader
If objCnn.Cnn(Cnn) Then
Cnn.Open()
Dim myCommand As New SqlCommand
myCommand.Connection = Cnn
Try
myCommand.CommandTimeout = 0
myCommand.CommandText = "Reporte"
myCommand.CommandType = CommandType.StoredProcedure
Dim P As New SqlParameter
P = myCommand.Parameters.Add("@FechaIni", SqlDbType.Int)
P.Value = FechaIni
P = New SqlParameter
P = myCommand.Parameters.Add("@FechaFin", SqlDbType.Int)
P.Value = FechaFin
Return myCommand.ExecuteReader
_IfError = False
Catch ex As Exception
_IfError = True
_ErrMsg = ex.Message
End Try
End If
End Function
End Class
Saludos Jorge Eldis
Leer las respuestas