Hello,
The following code and procedure doesn't work correctly. The SqlDataReader result is nothing.
It seems to bee a problem with the datetime parameters. (Without datetime parameters works OK)
Could you help me?
Thank you.
Dim conexion As String = ConfigurationSettings.AppSettings("ConexionSql")
Dim arParams(4) As SqlParameter
Dim fecha As DateTime
arParams(1) = New SqlParameter("@afiliadoId", "1")
fecha = Today
arParams(2) = New SqlParameter("@fIni", fecha)
fecha.AddDays(100)
arParams(3) = New SqlParameter("@fFin", fecha)
Dim reader As SqlDataReader = _
SqlHelper.ExecuteReader(conexion, _
CommandType.StoredProcedure, "wm_getReservasAfiliado", arParams)
dgReservas.DataSource = reader
dgReservas.DataBind()
and the stored procedure:
PROCEDURE dbo.wm_getReservasAfiliado
@afiliadoId as char(10),
@fIni as datetime,
@fFin as datetime
AS
SELECT [reservaId], [Fecha], [afiliadoId], [clienteRemoto], [telefonoRemoto], [estado] FROM [wm_reservas]
WHERE ((afiliadoId = @afiliadoId) and([Fecha] between @fIni and @fFin) )