Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
| Search | Today's Posts | Mark Forums Read
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 9th, 2004, 08:40 AM
Registered User
 
Join Date: Jul 2004
Location: Hyderabad, Andhra Pradesh, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mohithmohith
Default Exporting Crystal Report To Excel

Hi,
   When I am exporting crystal report to excel it is giving error 'Missing Parameter Current Value' even after passing the parameters. This is the code: can any one help.
Dim arrtemp As Array
        Dim strExportFileName As String
        Dim strExportFileNameWithPath As String
        Dim crtableLogoninfos As New TableLogOnInfos()
        Dim crtableLogoninfo As New TableLogOnInfo()
        Dim CrTables As Tables
        Dim CrTable As Table
        Dim TableCounter
        Dim crConnectionInfo As New ConnectionInfo()
        Dim crReportDocument As ReportDocument
        crReportDocument = New ReportDocument()

        Dim x, y As DateTime
        Dim z, z1, z2, z3 As String
        Dim Zd, Zd1 As Date
        Dim arrval As Array
        Dim i As Integer
        arrval = Split(Request.QueryString("FromDate"), "/")
        z2 = Trim(Replace(arrval(0), " ", ""))
        z1 = Trim(Replace(arrval(1), " ", ""))
        z3 = Trim(Replace(arrval(2), " ", ""))
        z = z1 & "/" & z2 & "/" & z3
        Zd = z
        arrval = Split(Request.QueryString("FromDate"), "/")
        z2 = Trim(Replace(arrval(0), " ", ""))
        z1 = Trim(Replace(arrval(1), " ", ""))
        z3 = Trim(Replace(arrval(2), " ", ""))
        z = z1 & "/" & z2 & "/" & z3
        Zd1 = z
        arrval = Split(Request.QueryString("FacilityID"), " ")
        i = arrval(0)

        crReportDocument.Load(Server.MapPath("\RevenueMedR eports\Reports\Formats\TrunaroundTime.rpt"))
        With crConnectionInfo
            .ServerName = ConfigurationSettings.AppSettings("ServerName")
            .DatabaseName = ConfigurationSettings.AppSettings("DatabaseName")
            .UserID = ConfigurationSettings.AppSettings("UserID")
            .Password = ConfigurationSettings.AppSettings("Password")
        End With
        CrTables = crReportDocument.Database.Tables
        For Each CrTable In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next
        rptViewer.ReportSource = crReportDocument
        Dim crExportOptions As ExportOptions
        Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
        Dim strRptName As String

        strRptName = "TrunaroundTime.rpt"
        arrtemp = strRptName.Split(".")
        strExportFileName = arrtemp(0)

        If strExportPath = "" Then
            strExportPath = "D:\RevenueMedReports\Reports\"
        End If
        If Directory.Exists(strExportPath) = False Then
            Directory.CreateDirectory(strExportPath)
        End If
        strExportFileNameWithPath = strExportPath + "\" + strExportFileName
       crDiskFileDestinationOptions = New DiskFileDestinationOptions()
        crExportOptions = crReportDocument.ExportOptions
        Response.Write("<BR><br>")
        Response.Write("Exporting Started")
        Select Case strExportFormat 'this contains the value of the selected export format.

            Case "Portable Document (PDF)"
                        crDiskFileDestinationOptions.DiskFileName = strExportFileNameWithPath & ".pdf"
                With crExportOptions
                    .DestinationOptions = crDiskFileDestinationOptions
                    .ExportDestinationType = ExportDestinationType.DiskFile
                    .ExportFormatType = ExportFormatType.PortableDocFormat
                End With
            Case "MS Excel (XLS)"
                crDiskFileDestinationOptions.DiskFileName = strExportFileNameWithPath & ".xls"

                With crReportDocument.ExportOptions
                    .ExportDestinationType = ExportDestinationType.DiskFile
                    .ExportFormatType = ExportFormatType.Excel
                    .DestinationOptions = crDiskFileDestinationOptions
                End With
        End Select 'export format
        Try
            Dim rptName, rptFormula, strPath As String
            Dim paramFields As New ParameterFields()
            Dim paramField As New ParameterField()
            Dim discreteVal As New ParameterDiscreteValue()
            paramField.ParameterFieldName = "@FromDate"
            discreteVal.Value = Request.QueryString("FromDate")
            paramField.CurrentValues.Add(discreteVal)
            paramFields.Add(paramField)

            paramField = New ParameterField()
            discreteVal = New ParameterDiscreteValue()
            paramField.ParameterFieldName = "@ToDate"
            discreteVal.Value = Request.QueryString("ToDate")
            paramField.CurrentValues.Add(discreteVal)
            paramFields.Add(paramField)

            paramField = New ParameterField()
            discreteVal = New ParameterDiscreteValue()
            paramField.ParameterFieldName = "@FacilityID"
            discreteVal.Value = Request.QueryString("FacilityID")
            paramField.CurrentValues.Add(discreteVal)
            paramFields.Add(paramField)

            rptViewer.ParameterFieldInfo = paramFields
            rptViewer.DataBind()

            crReportDocument.Export()
        Catch err As Exception
            Response.Write("<BR>")
            Response.Write(err.Message.ToString)
        End Try
    End Sub

Thanks & Regards
Mohith Kumar

K.S.Mohith Kumar
Software Engineer
Pioneer Online Pvt. Ltd
#3D, Samrat Complex, Saifabad
Hyderabad - 500004
Ph:0091-040-23299999 (ext : 320)
  #2 (permalink)  
Old July 12th, 2008, 12:36 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

check the following link , it is about to export crystal report to excel

http://vb.net-informations.com/cryst...port_excel.htm

bolton




Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in exporting crystal report to excel. yasinirshad .NET Framework 1.x 0 June 11th, 2008 02:20 AM
exporting report from crystal to notepad vishal_gpt@yahoo.com Access VBA 2 November 29th, 2007 06:17 AM
Code for Exporting Crystal Report to Excel or PDF shakti_2505270 ASP.NET 2.0 Professional 1 October 4th, 2007 01:00 AM
Exporting Crystal Report Harinder.Dhamija ASP.NET 2.0 Professional 1 July 24th, 2007 02:45 AM
Exporting Crystal Report to PDF vishal.jayaswal .NET Web Services 0 December 30th, 2004 03:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.