1

We use PBNI to call methods and open windows in C#, using a C++ DLL and Crystal Reports 10.

A window that contains a Crystal Reports Viewer OLE control shows nothing but a blank page, with no error. In debug mode in Powerbuilder, the report shows correctly. (Printing and exporting data work but not the viewer.)

Using Process Monitor, we can see that the C# executable seeks and finds many Crystal Reports dlls (including crviewer.dll) - The reports should connect to an Oracle database through ODBC. Consulting Oracle SQL history, I think that the viewer can’t connect to the database. But when I change the connection credentials (alias, id…) and try to get the SQLQueryString in the report, I have an error (so the credentials are correct.)

The report blank page with PBNI

The same report in debug mode (functional)

Powerbuilder code (Open event of the window):

OLEObject APP_CR, APPLICATION
OLEObject CONNECTION_INFO
APPLICATION = CREATE OLEObject
long li_ret
li_ret = APPLICATION.ConnectToNewObject('CrystalRuntime.Application.10')    
APP_CR = APPLICATION.OpenReport("C:\Apps\PB120\HeliosII\Dev\Etat\CLI_LST.rpt", 1)   
CONNECTION_INFO = APP_CR.database.tables[1].ConnectionProperties
CONNECTION_INFO.DeleteAll
CONNECTION_INFO.Add("DSN","DATABASE O10")
CONNECTION_INFO.Add("Database", "DATABASE") 
CONNECTION_INFO.Add("User ID","ETAT")
CONNECTION_INFO.Add("Password","ETAT")  

// Testing the connection
string ls_SQLQuery
ls_SQLQuery = APP_CR.SQLQueryString
APP_CR.SQLQueryString = ls_SQLQuery

// Showing the report
ole_CRViewer.object.ReportSource(App_CR)    
ole_CRViewer.object.ViewReport

C++ Dll code (calls a function that opens the window)

pbgroup group = session->FindGroup("nvo_lanceur", pbgroup_userobject);      
if (group == NULL) return false;

pbclass cls = session->FindClass(group, "nvo_lanceur");
if (cls == NULL) return false;

pbobject pbobj = session->NewObject(cls);
if (pbobj == NULL) return false;

pbmethodID mid = session->GetMethodID(cls, "of_traitermessage", PBRT_FUNCTION, "QS");

PBCallInfo ci;
session->InitCallInfo(cls, mid, &ci);

ci.pArgs->GetAt(0)->SetString(parameters);

// Call the function
try
{
    session->InvokeObjectFunction(pbobj, mid, &ci);

    // Was PB exception thrown?
    if (session->HasExceptionThrown())
    {
        // Handle PB exception
        session->ClearException();
    }
}
catch (...)
{
    // Handle C++ exception
}

The "of_traitermessage" function of the "nvo_lanceur" object calls an Open of the window that contains the viewer (and many other windows, depending on parameters.) The C# application calls a C++ method ever 100ms which calls a "session->ProcessPBMessage();" for dispatching powerbuilder event messages. How can I make this report display?

4444
  • 3,541
  • 10
  • 32
  • 43
Corentin
  • 15
  • 5

0 Answers0