水晶报表能在VC++2005中使用吗?

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:46:17
如何使用,请明示
在线等

评论 ┆ 举报

最佳答案此答案由提问者自己选择,并不代表百度知道知识人的观点

回答:爱你十万年
新手
9月27日 22:30 水晶报表是一个报表设计开发的强大工具,功能强大,设计灵活,在水晶报表光盘中只提供了一个完全动态生成报表的例子,使用繁琐。现介绍其在VC++6.0中的简单使用方法。编译环境:VC++6.0 sp5 、Windows 2000 Server sp3 (en)。

一、导入水晶报表使用的动态联接库:根据实际修改文件路径。

#import "C:\Documents and Settings\Administrator\桌面\cr\craxdrt9.dll" no_namespace

二、定义接口指针变量

//水晶报表变量

IApplicationPtr m_Application;

IReportPtr m_Report;

//水晶报表控件变量,在对话框中加入该控件

CCrystalReportViewer9 m_CRViewer1;

三、具体实现步骤

//实例化m_Application

m_Application.CreateInstance (__uuidof(Application));

//获取m_Report变量

//staff.rpt为通过向导建立的报表文件,数据库采用SQL Server 7.0

m_Report =m_Application->OpenReport ("C:\\Documents and Settings\\Administrator\\桌面\\cr\\debug\\staff.rpt");

//设置报表