Compiler Error Message: BC30311: Value of type 'Integer' cannot be converted to 'Date

Discussion in 'ASP' started by dk8, Sep 27, 2007.

  1. dk8

    dk8 New Member

    Sep 27, 2007
    Likes Received:
    Trophy Points:
    I wrote a report in crystal reports, version 11 and wrote a .aspx page as a user interface for users to input data for their report selection. When I click on the link to take me to my .aspx page, I get the Compiler Error Message: BC30311: Value of type 'Integer' cannot be converted to 'Date'. This report is currently working in our live version, but not test. The report and the code behind remain unmodified as far as I know. Can someone please look at the the code I have attached? The lines in bold are where the error is occurring. Any comments/suggestions would be appreciated. Thank you in advance!

    Public Sub GenerateReport()
        Dim dsProposalRecs As DataSet
        Dim dsRptRecs As New DataSet
        Dim drProposalRec As DataRow
        Dim strSQL As String
        Dim strErr As String
        Dim strHTMLErr As String
        Dim strStatusSelection As String
        Dim strDateSelection As String
        Dim intDateSelection As Integer
        Const strMethodName As String = "GenerateReport"
          If (Me.rdoEffectiveDate.Checked) Then
            intDateSelection = 1
            strDateSelection = "Effective Date"
          ElseIf (Me.rdoProposalDate.Checked) Then
            intDateSelection = 2
            strDateSelection = "Proposal Date"
          ElseIf (Me.rdoStatusDate.Checked) Then
            intDateSelection = 3
            strDateSelection = "Status Date"
            intDateSelection = 0
            strDateSelection = ""
          End If
          strStatusSelection = Me.ddlStatus.SelectedValue
          If (BlankField(strStatusSelection)) Then
            strStatusSelection = "NONE"
          End If
                    If ((BlankField(Request.Form("txtFrom"))) And (BlankField(Request.Form("txtTo")))) Then
                        dsProposalRecs = ReportsDB.GetActivityReportData(0, _
                                                                       0, _
                                                                    [B]   0, _[/B]
                                                                       Convert.ToDateTime(Date.Now), _
                                                                       intDateSelection, _
                                                                       strStatusSelection, _
                                                                       Application("cpConnection"), _
                                                                       Application, Session, Response)
                        dsProposalRecs = ReportsDB.GetActivityReportData(0, _
                                                                       0, _
                                                                      [B] 0, _[/B]
                                                                       Convert.ToDateTime(Request.Form("txtFrom")), _
                                                                       intDateSelection, _
                                                                       strStatusSelection, _
                                                                       Application("cpConnection"), _
                                                                       Application, Session, Response)
                    End If
          strSQL = "Exec spDeleteProposalActivityReportTableByID "
          strSQL += ReturnFieldArgument("@UserID", Session("LoginID"), False)
          RunStoredProcedure(strSQL, Application("rptConnection"), Application, Session, Response)
          For Each drProposalRec In dsProposalRecs.Tables("ActivityRecs").Rows
            strSQL = "Exec spInsertProposalActivityReportTable "
            strSQL += ReturnFieldArgument("@CaseName", drProposalRec.Item("CASENAME"), True)
            strSQL += ReturnFieldArgument("@HeadState", drProposalRec.Item("HEADQUARTERSTATE"), True)
            strSQL += ReturnFieldArgument("@NAICS", drProposalRec.Item("NAICSCODE"), True)
            strSQL += ReturnFieldArgument("@NAICSDesc", drProposalRec.Item("NAICSDESCRIPTION"), True)
            strSQL += ReturnFieldArgument("@ProdDesc", drProposalRec.Item("PRODUCTDESCRIPTION"), True)
            strSQL += ReturnFieldArgument("@LFID", drProposalRec.Item("LAKEFORESTPROPOSALID"), True)
            strSQL += ReturnFieldArgument("@Status", drProposalRec.Item("STATUS"), True)
            strSQL += ReturnFieldArgument("@TotalLives", drProposalRec.Item("TOTALNUMBEROFLIVES"), True)
            strSQL += ReturnFieldArgument("@DateQuoted", drProposalRec.Item("DATEQUOTED"), True)
            strSQL += ReturnFieldArgument("@StatusDate", drProposalRec.Item("STATUSDATE"), True)
            strSQL += ReturnFieldArgument("@EffectiveDate", drProposalRec.Item("EFFECTIVEDATE"), True)
            strSQL += ReturnFieldArgument("@SalesDirName", drProposalRec.Item("SALESDIRECTORNAME"), True)
                        'strSQL += ReturnFieldArgument("@SalesVPName", drProposalRec.Item("SALESVPNAME"), True)
            strSQL += ReturnFieldArgument("@ProducerName", drProposalRec.Item("producerfullname"), True)
            If (Not (IsDBNull(drProposalRec.Item("target")))) Then
              If (drProposalRec.Item("target") = "N") Then
                strSQL += ReturnFieldArgument("@TargetProducer", 0, True)
                strSQL += ReturnFieldArgument("@TargetProducer", 1, True)
              End If
            End If
            strSQL += ReturnFieldArgument("@ProducerPhone", drProposalRec.Item("phone"), True)
                        'If (Me.rdoVicePresident.Checked) Then
                        'strSQL += ReturnFieldArgument("@PageBreak1", drProposalRec.Item("SALESVPNAME"), True)
                        'strSQL += ReturnFieldArgument("@PageBreak2", drProposalRec.Item("SALESDIRECTORNAME"), True)
                        'strSQL += ReturnFieldArgument("@PageBreak3", drProposalRec.Item("producerfullname"), True)
                        'strSQL += ReturnFieldArgument("@PageBreak4", drProposalRec.Item("CASENAME"), True)
                        'strSQL += ReturnFieldArgument("@PageBreak1Label", "Regional Vice President:", True)
                        'strSQL += ReturnFieldArgument("@PageBreak2Label", "Regional Sales Director:", True)
                        'strSQL += ReturnFieldArgument("@PageBreak3Label", "Producer:", True)
                        'strSQL += ReturnFieldArgument("@PageBreak4Label", "Case Name:", True)
                        If (Me.rdoProducer.Checked) Then
                            strSQL += ReturnFieldArgument("@PageBreak1", drProposalRec.Item("producerfullname"), True)
                            strSQL += ReturnFieldArgument("@PageBreak4", drProposalRec.Item("CASENAME"), True)
                            strSQL += ReturnFieldArgument("@PageBreak1Label", "Producer:", True)
                            strSQL += ReturnFieldArgument("@PageBreak4Label", "Case Name:", True)
                        ElseIf (Me.rdoCase.Checked) Then
                            strSQL += ReturnFieldArgument("@PageBreak1", drProposalRec.Item("CASENAME"), True)
                            strSQL += ReturnFieldArgument("@PageBreak2", drProposalRec.Item("SALESDIRECTORNAME"), True)
                            strSQL += ReturnFieldArgument("@PageBreak3", drProposalRec.Item("producerfullname"), True)
                            strSQL += ReturnFieldArgument("@PageBreak1Label", "Case Name:", True)
                            strSQL += ReturnFieldArgument("@PageBreak2Label", "Regional Sales Director:", True)
                            strSQL += ReturnFieldArgument("@PageBreak3Label", "Producer:", True)
                        End If
                        If (Not (BlankField(strDateSelection))) Then
                            strSQL += ReturnFieldArgument("@Criteria1", "From " & Request.Form("txtFrom") & " thru " & Request.Form("txtTo"), True)
                            strSQL += ReturnFieldArgument("@Criteria2", "Based on: " & strDateSelection, True)
                        End If
                        If (strStatusSelection <> "NONE") Then
                            strSQL += ReturnFieldArgument("@Criteria3", "Status Selected: " & strStatusSelection, True)
                        End If
                        strSQL += ReturnFieldArgument("@Criteria4", "By All", True)
                        strSQL += ReturnFieldArgument("@UserID", Session("LoginID"), False)
                        RunStoredProcedure(strSQL, Application("rptConnection"), Application, Session, Response)
        Catch ex As Exception
          If (ex.Message = "Collection is read-only.") Then
              strErr = Now() & sSpace & ex.Message & sSpace & _
               "Has Occurred in " & Replace(Err.Source, "|", vbCrLf) & vbCrLf & "In " & Convert.ToString(Application("AppVirtualDir")) & ":" & _
               strMethodName & vbCrLf & ex.StackTrace
              SendError(strErr, Application, Session, Response)
              strHTMLErr = strErr.Replace(vbCrLf, "<br>")
              If (Not (System.Diagnostics.EventLog.SourceExists(Convert.ToString(Application("AppVirtualDir")), "."))) Then
                System.Diagnostics.EventLog.CreateEventSource(Convert.ToString(Application("AppVirtualDir")), "Application")
              End If
              Dim appLog As New System.Diagnostics.EventLog("Application", ".", Convert.ToString(Application("AppVirtualDir")))
              appLog.WriteEntry(strErr, System.Diagnostics.EventLogEntryType.Error)
          End If
        End Try
        Session("ReportName") = "ProposalActivityReport.rpt"
        Session("ExportName") = "ActivityRpt"
        Session("ReportTitle") = "Activity Report"
        Session("PrevPage") = "Blank.aspx"
        Session("NextPage") = "CRReports-Dynamic.aspx"
        Session("spCall") = "spSelectProposalActivityReportTableByID "
        bytLoadOpt = 1
      End Sub
    Last edited by a moderator: Sep 28, 2007
  2. urstop

    urstop New Member

    Oct 17, 2007
    Likes Received:
    Trophy Points:
    What is the line number of your error. Going thru the whole code without knowing the line of error is difficult to find out the issue.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice