on 08-19-2009 5:11 PM
I'm attempting to upgrade my current Crystal Export application from CR XI with Classic ASP to CR 2008 with ASP.NET and am in need of some assistance.
OLD APPLICATION - ENVIRONMENT
-
VB 6.0
CR XI Developer Edition
Classic ASP
VB project references "Crystal Reports ActiveX Designer Run Time Library 11.0" (...\Business Objects\3.0\bin\craxdrt.dll)
and makes use of the following objects:
CRAXDRT.Application
CRAXDRT.Report
CRAXDRT.ParameterFieldDefinitions
CRAXDRT.ExportOptions
CRAXDRT.ConnectionProperty
CRAXDRT.DatabaseTable
I created my own ActiveX DLL that was installed on the Web Server (IIS).
OLD APPLICATION - EXAMPLE
-
Classic ASP would create an object (Server.CreateObject("WebCrystalReport.RptExporter11")).
Based on some criteria, a report (RPT) would be pulled from the database and opened.
A number of RPT parameters would be passed to the object and updated in the report.
The report would then be run-exported to PDF, and the PDF would be streamed to the user.
NEW APPLICATION - ENVIRONMENT
-
Visual Studio 2008 Professional Edition
CR 2008 (Full Edition; not what was included with VS)
ASP.NET
NEW APPLICATION - QUESTIONS
-
I see that VS 2008 Prof. Ed. comes with a CrystalReportViewer object. I do not wish to view the RPT; only to export it to PDF. Must I include this control on my ASPX page (regardless of whether or not I wish to view the RPT) just to access the Crystal objects? If I can just add a referece as I did in VB 6, to what Crystal resource do I add the reference in order to gain access to the same objects?
Once I know what to include in my ASP.NET project I can use Object Viewer to find the objects and methods I need. Unfortunately, it isn't always so clear with Crystal. It would be VERY helpful if you could look at list above or the code example below and tell me where I can find these objects in CR 2008.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OLD APPLICATION - VERY TRUNCATED CODE EXAMPLE
-
This is a very brief, truncated, and heavily edited stub of OLD code that I need to replace. Any help you can give would be greatly appreciated.
'Open report using "CRAXDRT.Application" object and save reference in object created from "CRAXDRT.Report"
CRReport = CRAppl.OpenReport(strReportSpec)
'Discard any saved data in Crystal
CRReport.DiscardSavedData()
'Access the report parameters and save them to an abject created from "CRAXDRT.ParameterFieldDefinitions"
CRParamDefs = CRReport.ParameterFields
'Loop through all parameters and update them if found in our dictionary object
For iI = 1 To CRParamDefs.Count
If dicParams.ContainsKey(CRParamDefs(iI).Name) Then
'Update the parameter using the proper data type
Select Case CRParamDefs.Item(iI).ValueType
Case crBooleanField
CRParamDefs.Item(iI).AddCurrentValue(CBool(dicParams(strParamName)))
Case crCurrencyField
CRParamDefs.Item(iI).AddCurrentValue(CCur(dicParams(strParamName)))
Case crDateField
etc.
End Select
End If
Next
'Turn off parameter prompting
CRReport.EnableParameterPrompting = False
Edited by: RichBrolly on Aug 19, 2009 6:15 PM
'Set the Report options using an object created from "CRAXDRT.ExportOptions"
CRExportOptions = CRReport.ExportOptions
CRExportOptions.FormatType = m_intFormatType ' set output format (typically PDF)
CRExportOptions.DestinationType = crEDTDiskFile ' write to disk
CRExportOptions.DiskFileName = strFileFullDir ' where it goes
Select Case m_intFormatType
Case crEFTPortableDocFormat
CRExportOptions.PDFExportAllPages = True ' all the pages
etc.
End Select
'Update the Report DB UID and DB PWD if they want us to
If m_UpdateConnectionString Then
Dim objCR_ConnProp As CRAXDRT.ConnectionProperty
Dim objCR_DataTable As CRAXDRT.DatabaseTable
'And then, which format? OLEDB
If m_ConnectionStringType = "OLEDB" Then
For Each objCR_DataTable In CRReport.Database.Tables
objCR_ConnProp = objCR_DataTable.ConnectionProperties("User ID")
If m_DB_UserID <> "" Then objCR_ConnProp.value = m_DB_UserID
objCR_ConnProp = objCR_DataTable.ConnectionProperties("Password")
If m_DB_Pasword <> "" Then objCR_ConnProp.value = m_DB_Pasword
Next
End If
etc. etc. etc.
End If
'Export the Report without user intervention
CRReport.Export(False)
RDC is not supported in .NET. See the following re. RDC in .NET for more information:
[RDC statement of Direction|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/80bd35e5-c71d-2b10-4593-d09907d95289]
[Using the Report Designer Component in Microsoft Visual Studio .NET|https://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/f0751a7f-a81d-2b10-55a0-e6df0e1bab6d&overridelayout=true] article.
[Note 1217809|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
[Report Designer Component - Past, Present & Future|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/11624] [original link is broken] [original link is broken] [original link is broken]; blog.
Ludek
Thanks. I knew the RDC had been discontinued for .NET. I guess I was being lazy in try to find the correct objects in CR 2008.
I found the following to be very helpful:
ReportDocument Object Model (http://msdn.microsoft.com/en-us/library/ms225250.aspx)
and
Crystal Reports API Reference (http://msdn.microsoft.com/en-us/library/bb944221.aspx)
Which lead me to the Engine and Shared namespaces, where I found what I was looking for.
Thanks for your help.
Rich
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.