Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, New to crystal reports. How do I view my reports? Using Oracle

Status
Not open for further replies.

hne

Programmer
Oct 16, 2003
38
US
. . .
.
.
#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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top