DH
Programmer
- Dec 8, 2000
- 168
I have 2 input text boxes for users to enter a start date and end date to query the SQL database.
Here is the code....
Else
Dim searchdatestart
Dim searchdateend
searchdatestart = Session("searchdatestartquote")
searchdateend = Session("searchdateendquote")
cmdSelect = New SqlCommand("Select ID, dpurpose, tcontactname, timestamp, submitdate From Quotes WHERE submitdate BETWEEN ' & '#' & searchdatestart & '#' & ' And ' & '#' & searchdateend & '#' & ' Order By '" & strSortField, SqlConnection1)
End If
SqlConnection1.Open()
DataGrid1.DataSource = cmdSelect.ExecuteReader()
DataGrid1.DataBind()
SqlConnection1.Close()
Here is the error:
Message: Exception of type System.Web.HttpUnhandledException was thrown.
Source: System.Web
TargetSite: HandleError
InnerException: Cast from string "9/1/2004" to type 'Long' is not valid.
Stack Trace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Any suggestions on how to fix??
Thanks,
DH
Here is the code....
Else
Dim searchdatestart
Dim searchdateend
searchdatestart = Session("searchdatestartquote")
searchdateend = Session("searchdateendquote")
cmdSelect = New SqlCommand("Select ID, dpurpose, tcontactname, timestamp, submitdate From Quotes WHERE submitdate BETWEEN ' & '#' & searchdatestart & '#' & ' And ' & '#' & searchdateend & '#' & ' Order By '" & strSortField, SqlConnection1)
End If
SqlConnection1.Open()
DataGrid1.DataSource = cmdSelect.ExecuteReader()
DataGrid1.DataBind()
SqlConnection1.Close()
Here is the error:
Message: Exception of type System.Web.HttpUnhandledException was thrown.
Source: System.Web
TargetSite: HandleError
InnerException: Cast from string "9/1/2004" to type 'Long' is not valid.
Stack Trace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Any suggestions on how to fix??
Thanks,
DH