Crystal 8's RDC: need an example of the RDC running against SQL Server. 
Author Message
 Crystal 8's RDC: need an example of the RDC running against SQL Server.

I've been posting some mentions to this newsgroup for only a few days.  I'm
really have a LOT or trouble trying to get anything to work with Crystal 8's
RDC and the CRViewer.  (I'm using VB6 Enterprise Edition.)  I'm beginning to
think that my problem is all of the example code I've seen, to this point,
uses MS Access.  I need some example code which accesses MS SQL Server,
using stored procedures with parameters passed to them and formulas that are
a part of the report (embodied in .RPT files).

Where can I find examples of code that does that?

Rod



Fri, 12 Dec 2003 22:51:51 GMT  
 Crystal 8's RDC: need an example of the RDC running against SQL Server.
Hope this helps:

' Get report
Set CrxReport = CrxApplication.OpenReport(FileLocation)
' Pass down a parameter to the report
CrxReport.ParameterFields("name").SetCurrentValue ("value")
' Set a formula
CrxReport.FormulaFields("name").Text = "{orders.orderamount}*5"
' Pass the Report object to the CrViewer control
CRViewer1.ReportSource = CrxReport
' Log on to server
CrxReport.Database.Tables.Item(1).SetLogOnInfo "DSN name", "", "username",
"password"
' Enable Export Button
CRViewer1.EnableExportButton = True
' View the report in the CrViewer
CRViewer1.ViewReport


Quote:
> I've been posting some mentions to this newsgroup for only a few days.
I'm
> really have a LOT or trouble trying to get anything to work with Crystal
8's
> RDC and the CRViewer.  (I'm using VB6 Enterprise Edition.)  I'm beginning
to
> think that my problem is all of the example code I've seen, to this point,
> uses MS Access.  I need some example code which accesses MS SQL Server,
> using stored procedures with parameters passed to them and formulas that
are
> a part of the report (embodied in .RPT files).

> Where can I find examples of code that does that?

> Rod



Mon, 15 Dec 2003 02:39:47 GMT  
 Crystal 8's RDC: need an example of the RDC running against SQL Server.
Yes, it does, thank you Erik!

Rod


Quote:
> Hope this helps:

> ' Get report
> Set CrxReport = CrxApplication.OpenReport(FileLocation)
> ' Pass down a parameter to the report
> CrxReport.ParameterFields("name").SetCurrentValue ("value")
> ' Set a formula
> CrxReport.FormulaFields("name").Text = "{orders.orderamount}*5"
> ' Pass the Report object to the CrViewer control
> CRViewer1.ReportSource = CrxReport
> ' Log on to server
> CrxReport.Database.Tables.Item(1).SetLogOnInfo "DSN name", "", "username",
> "password"
> ' Enable Export Button
> CRViewer1.EnableExportButton = True
> ' View the report in the CrViewer
> CRViewer1.ViewReport



Mon, 15 Dec 2003 03:43:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. RDC with dbgrid and SQL Server - can't insert first row

2. RDC for Crystal 8: IsBusy runs slow?

3. CR RDC-6 vs RDC-8

4. Problem with SQL Server, VB 5.0 using a Grid and RDC

5. Apex True DBCombo does not work with SQL Server/RDC

6. RDC and VB : error 20599 (unable to open SQL server)

7. Best Practice using RDC, VB, SQL Server

8. RDO/RDC Sources and examples

9. Need help with SQL query 'AND'ing a field against a constant

10. 'Sample code for RDC required'

11. Q: Crystal reports against SQL server with IIS

12. Error running SQL against another USer's tables

 

 
Powered by phpBB® Forum Software