Tried to retrieve data from input dataset. But get this 'SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM' error. I guess it's a typical question. Can anybody help as soon as possible, please?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
In .aspx page: <%# DataBinder.Eval(Container.DataItem, "StartTime", "{0:T}") %>
In .aspx.vb: Dim StartTime As Date = Request.Params("StartTime") underneath page_load
In Components/ProductsDB:
Public Function GetProducts2c(ByVal categoryID As Integer, ByVal State As String, ByVal StartTime As Date) As SqlDataReader
' Create Instance of Connection and Command Object
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As SqlCommand = New SqlCommand("CMRC_ProductsByCategory2c", myConnection)
' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure
' Add Parameters to SPROC
Dim parameterStartTime As SqlParameter = New SqlParameter("@StartTime", SqlDbType.DateTime, 8)
parameterStartTime.Value = StartTime
myCommand.Parameters.Add(parameterStartTime)
' Execute the command
myConnection.Open()
Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
' Return the datareader result
Return result
End Function
In Stored Procedure:
CREATE Procedure CMRC_ProductsByCategory2c
(
@StartTime DateTime
)
AS
SELECT
convert(varchar,CA.StartTime,108)
FROM
CMRC_AppointmentTime CA
WHERE
convert(varchar,CA.StartTime,108)>=convert(varchar,@StartTime,108)
GO
Used SQL Query Analyser to test the Stored Procedure, it was fine. But it just gave me error when used in website. Can anybody answer my question as soon as possible, please?!!!!!!!!!!!!