Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Reports, Printing, Printers: Connecting to a MSSQL db and printing a Crystal Report 2003-01-29 -- Marcos Mateo Zorola Newsgroups: comp.lang.clarion
> I have a User DSN set up for use with Crystal Reports. I am using the
> standard ABC templates to run the reports (Crystal 8.5).
>
> How do I log into the SQL Server before the report is run?
>
> I would like to use native Clarion or OLE if necessary. No 3rd Party
> Templates using CW55EE ABC.
I had just posted this in the C55 newsgroup. It is simple.
Try this. Its simple and works. (Crystal Reports v8.5)
Create an OLE control on your window and call it CrystalOLE.
Place the following code in the window init after the window is opened:
?CrystalOLE{prop:create}='Crystal.CrystalReport';
?CrystalOLE{prop:reportexception}=TRUE; !Set this flag to TRUE to see OLE errors.
?CrystalOLE{prop:doverb}=0;
Place the following code in response to a report print request (button press
for example):
?CrystalOLE{'ReportFileName'}='CheckReport.rpt'; !Put your report name here.
!This is your SQL connection string
?CrystalOLE{'Connect'}='DSN=YourSQLServerName;' &|
'UID=YourSQLUserName;' &|
'PWD=YourSQLUserNamePassword;' &|
'DSQ=;'
?CrystalOLE{'Destination'}=1; !Send to printer; 0 sends to screen.
?CrystalOLE{'SelectionFormula'}=ReportFormula;
!Set this variable (ReportFormula) to the record
!selection formula you want for this report.
?CrystalOLE{'Action'}=1; !Run the report.
Place this code at window close or procedure terminate but before the window
is destroyed:
?CrystalOLE{prop:deactivate};
Have fun. As for as I am concerned, Crystal Reports is the only way to go
for creating reports.
Today is November 21, 2024, 3:51 am This article has been viewed 35411 times. Google search has resulted in 270 hits on this article since January 25, 2004.
|
|