Link to home
Start Free TrialLog in
Avatar of Michael G
Michael G

asked on

Error:599 Cannot open SQL server

Error:599 Cannot open SQL server
Execute <PEStartPrintJob>.

I use Delphi5 Enterprise (Update pack 1 and Delphi 5 ADOExpress Update Pack 2 are installed) and the Crystal Reports VCL v. 7.5.0.52 to view/print my reports. The reports are designed in Crystal Reports 8 Developer Edt. and I use af MS SQL Server 7.

The above problem occurs when I try to show/print the report with other data than the ones that was saved with the report. Fx, I preview the report in Crystal Reports with the parameter id "7" and saves the data with the report - no problem there. If I then try to open the report (also with parameter id "7") in my Delphi program, everything still works fine. But, if I from my Delphi program opens the report using parameter id "2", then the above error occurs.

The "Convert database driver" tells me that I'm using the "pdssql.dll" to connect to my SQL Server. Isn't pd*.dll old 16bit drivers !? I've download p2ssql.dll v. 8.0.0.21 from Crystals web site, but I can't select it in the "Convert database driver" list !?

Hope you have a solution to my problem.

Thanks in advance.
SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael G
Michael G

ASKER

The problem occurs both on my developer PC and on the client PC.

A Verify Database return "The database is up to date"

Everything works fine when I preview the report in CR, and I can without any problems load correct data with every valid parameter. The problem is only in my Delphi application.
Just saw how you are calling the report using the CR Print engine.  Did you load the Print Engine when you loaded CR?  I don't believe it is included as a default.  If not do an update install and select custom to add the print engine.

mlmcc
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
mlmcc: What do you mean by "Did you load the Print Engine when you loaded CR?" !? I did a complete install of CR when I installed it.

jrmn: I don't use ODBC. I connect directly to the SQL server. I don't use the newest version of the 8/8.5 VCL because of 2 reasons: 1) I used Delphi7 when I started this project (and yes, I'm aware of Zimmerman's site) but I never got i to work 100%. 2) My existing code (the procedure below) doesn't work with the 8/8.5 version of VCL, and I don't really have time to rewrite it. I know it's a small procedure, and if I don't get it working soon with the 7 version of the VCL, I'll have to rewrite the procedure and install the versoin 8/8.5 of the VCL.

The following procedure is used to open my reports, and I've never had these problems before.

procedure TFMain.OpenReport(Print: Boolean; Report: String; Id: Integer);
var
  i: Integer;
begin
  If Report = 'Recept' Then
    CRDelphi.ReportName := mReceptPath
  Else If Report = 'Invoice' Then
    CRDelphi.ReportName := mInvoicePath;

  CRDelphi.WindowState := wsMaximized;
  CRDelphi.LogOnInfo.Retrieve;
  CRDelphi.LogOnInfo.Password := mConnPass;
  If Print Then
    CRDelphi.Output := toPrinter
  Else
   CRDelphi.Output := ToWindow;

  CRDelphi.ParamFields.Retrieve;

  For I := 0 to (CrDelphi.ParamFields.Count - 1) do Begin
    IF CRDelphi.ParamFields[I].Name = '@ReceptID' Then begin
      CRDelphi.ParamFields[I].Value := IntToStr(Id);
    end;
  End;
  CRDelphi.Execute;
end;

I've checked that "CRDelphi.LogOnInfo.Retrieve;" gets the correct logon information. At first, the password field was not set, but it didn't change anything after I manually gave it the password.

I've also tried to add "CRDelphi.OpenEngine;" in my FormCreate, but that didn't help either.

/Snebal
By doing a complete install you loaded the PrintEngine files.  Crystal has several methods for viewing reports.  Some of them don't get installed on a machine except with a full or selected through custom.

I am not familiar with Delphi and the VCL method of displaying reports but if you have built the reports in CR 8 it may be the VCL7.5 cannot open the report since the report file formats changed from CR7 to CR8.

How are you passing the parameter id to the report?

Is there data saved with the report?

mlmcc
mlmcc: I use the "For loop" in the function i posted earlier, to pass the paramters to the report. (CRDelphi.ParamFields[I].Value := IntToStr(Id);)

There are some data saved with the report, and everything works if I open the report with the parameter that I used for saving data with the report.

jrmn: I've now tried using the version 8.5.0.9 og the VCL and rewrote my function so I can use it with the new VCL. It just still doesn't work ;(

/Snebal
Finally - It works !

I don't know what was wrong, but I guess I've mangled too much with the settings on the CR VCL component, because after I deleted it and placed a new one on my form, and then followed jrmn's instructions in https://www.experts-exchange.com/questions/20240251/crystal-report-and-delphi.html - it finally worked :)

This is the procedure I now use with version 8.5.0.9 of the CR VCL for Delphi 5.

procedure TFMain.OpenReport(Print: Boolean; Report: String; Id: Integer);
var
  I: Integer;
begin
  If Report = 'Recept' Then
    Crystal.ReportName := mReceptPath
  Else If Report = 'Invoice' Then
    Crystal.ReportName := mInvoicePath;

  If Print Then
    Crystal.Output := ToPrinter
  Else
    Crystal.Output := ToWindow;

  Crystal.Connect.ServerName := 'SOLLE';
  Crystal.Connect.UserID :='gruppe2';
  Crystal.Connect.Password :='dimser';
  Crystal.Connect.DatabaseName :='konsultation';
  Crystal.Connect.Propagate :=True;

  if not Crystal.Connect.Test then
    MessageDlg(Msg23 + Crystal.LastErrorString, mtError, [mbOk], 0);

  Crystal.WindowState := wsMaximized;

  For I := 0 to (Crystal.ParamFields.Count - 1) do Begin
    IF Crystal.ParamFields[I].Name = '@ReceptID' Then begin
      Crystal.ParamFields[I].CurrentValue := IntToStr(Id);
    end;
  End;
  Crystal.Execute;
end;

So I guess the points goes to jrmn, or can I split them so both of you get 125 point !?

But anyway, thanks for your help :)

/Snebal

OPen the report and save the report with the 'save data with report' box as unchecked.
Refresh the report in the report server.so when you run the report , also set the 'database logon' information. ...
I haven't had to accept an answer in the new EE system yet but it is my understanding you can accept multiple answers and split the points or accept an answer and an assisting answer.

If you aren't sure how to do it, submit a 0 point question in the Community Support forum and ask for help.

mlmcc
You both (hopefully) got 125 points for this question. Thank you for your help.

/Snebal
Glad I could help

mlmcc