• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 892
  • Last Modified:

Delphi - Crystal 11 ActiveX/RDC : Need example setting database connection & parameters -

I am using Delphi 7 & 2007, Crystal 11 [ActiveX / RDC] and MS-SQL2005
I  imported the Crystal type library.
I've tried two ways to create a report view: oApp and iApp
They both work as long as I do not need to change the database or parameters
I would appreciate an example showing how to set the runtime database
connection and runtime parameters for an MS-SQL stored procedure used by the report.
Thank you,
Robert Baker


==============
procedure TTestCR11.cxButton2Click(Sender: TObject);
var MyPath:string;
begin
  if Form2 = nil then
    Form2 := TForm.Create(self);
  Form2.Height := Height * 3;
  Form2.Width := Width * 3;
  CrystalActiveXReportViewer1 := TCrystalActiveXReportViewer.Create(Form2);
  oApp :=CreateOleObject('CrystalRuntime.Application');
  MyPath := 'C:\Crystal\' + cxListBox2.Items[cxListBox2.ItemIndex];
  oRpt:=oApp.openreport(MyPath,1);
  CrystalActiveXReportViewer1.Parent := Form2;
  CrystalActiveXReportViewer1.Align := alClient;
  CrystalActiveXReportViewer1.ReportSource := oRpt;
  CrystalActiveXReportViewer1.ViewReport;
  Form2.Show;
end;
===============
var
    iApp : CRAXDRT_TLB.TApplication;
    iRep : CRAXDRT_TLB.IReport;
begin
  iApp  := CRAXDRT_TLB.TApplication.Create(Self);
  iRep  := iApp.OpenReport('C:\mycrystal.rpt', CrOpenReportByTempCopy);
  iRep.Database.LogOnServer('crbd_ado.dll', 'mysqlserver', 'mydatabase', 
'myuserid', 'mypassword');
  iRep.EnableParameterPrompting := False;
  iRep.Database.Verify;

Open in new window

0
zxytek
Asked:
zxytek
1 Solution
 
zxytekAuthor Commented:
The only suggested solution is a link to the SAP site that was not helpful.
An accepted solution was found via the Delphi newsgroups.
Please delete this question. Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now