. . .
.
.
#import "mycrpt.dll" no_namespace
CString strQuery;
IApplicationPtr pApp;
IReportPtr pReport;
VARIANT var;
strQuery.Empty();
strQuery.AllocSysString();
strQuery.Format("select "
"FlightID, FltNbr, FltDate, AlName, "
"LastDepart, ShipNbr, Routing, Destination, "
"HumanRem, LiveAnimals, Notes1, OAL_Flight_Nbr,"
"FlightID, Type, Status, "
"Verified, DeltaEmp, SSRCodes "
"from "
"Flight Flight, "
"PsgrFltData PsgrFltData "
"where "
"FlightID = FlightID AND "
"Status = 'ON' "
;
CoInitialize(NULL);
pApp.CreateInstance("CrystalRuntime.Application"
;
pReport = pApp->OpenReport("filename.rpt", var);
HRESULT hr = pApp->LogOnServerEx("pdsodbc.dll", b_svr, "", b_usr, b_psw);
if (SUCCEEDED(hr))
{ // Dispose of BSTRs...
SysFreeString(b_svr);
SysFreeString(b_usr);
SysFreeString(b_psw);
}
_bstr_t query = strQuery.AllocSysString();
pReport->PutSQLQueryString(query); // apply the modified SQL Query
UpdateData(TRUE); //refresh and update the dialog's data
m_rpViewer.SetReportSource(pReport); // m_rpView is my Crystal Report Viewer control...
m_rpViewer.PrintReport();
m_rpViewer.ViewReport();
m_rpViewer.Zoom(100);
pApp.Release();
pReport.Release();
pReport = NULL;
pApp = NULL;
strQuery.ReleaseBuffer();
. . .
.
.
.
I don't get it. I created the instance, logged on, SetReportSource to my CR Viewer. However, when I view my report, the data is not there. If I run the command from SQL Plus, I can see my data. I have created the fields in my .rpt file. Please help. Thx.
.
.
#import "mycrpt.dll" no_namespace
CString strQuery;
IApplicationPtr pApp;
IReportPtr pReport;
VARIANT var;
strQuery.Empty();
strQuery.AllocSysString();
strQuery.Format("select "
"FlightID, FltNbr, FltDate, AlName, "
"LastDepart, ShipNbr, Routing, Destination, "
"HumanRem, LiveAnimals, Notes1, OAL_Flight_Nbr,"
"FlightID, Type, Status, "
"Verified, DeltaEmp, SSRCodes "
"from "
"Flight Flight, "
"PsgrFltData PsgrFltData "
"where "
"FlightID = FlightID AND "
"Status = 'ON' "
CoInitialize(NULL);
pApp.CreateInstance("CrystalRuntime.Application"
pReport = pApp->OpenReport("filename.rpt", var);
HRESULT hr = pApp->LogOnServerEx("pdsodbc.dll", b_svr, "", b_usr, b_psw);
if (SUCCEEDED(hr))
{ // Dispose of BSTRs...
SysFreeString(b_svr);
SysFreeString(b_usr);
SysFreeString(b_psw);
}
_bstr_t query = strQuery.AllocSysString();
pReport->PutSQLQueryString(query); // apply the modified SQL Query
UpdateData(TRUE); //refresh and update the dialog's data
m_rpViewer.SetReportSource(pReport); // m_rpView is my Crystal Report Viewer control...
m_rpViewer.PrintReport();
m_rpViewer.ViewReport();
m_rpViewer.Zoom(100);
pApp.Release();
pReport.Release();
pReport = NULL;
pApp = NULL;
strQuery.ReleaseBuffer();
. . .
.
.
.
I don't get it. I created the instance, logged on, SetReportSource to my CR Viewer. However, when I view my report, the data is not there. If I run the command from SQL Plus, I can see my data. I have created the fields in my .rpt file. Please help. Thx.