请教有关调用水晶报表的问题,请各位不吝赐教!!!

zhp97 2003-10-14 08:57:24
我用delphi6调用外部设计好的水晶报表,但必须动态设置连接的数据库(运行时连接access文件)。
下面是我的代码,运行正常,但数据不是我新设置的数据库数据

report := Application1.OpenReport('E:\Crw\报表\dj.rpt',crOpenReportByTempCopy);
Report.DiscardSavedData;
strconn:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=E:\概预算系统\image\Data.mdb;Mode=Share Deny None;Extended Properties="";Persist Security Info=False;Jet OLEDB:System database="";Jet OLEDB:Registry';
strconn:=strconn+' Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database';
strconn:=strconn+' Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';
Report.Database.AddOLEDBSource(strconn,'D单价库');
report.Database.SetDataSource(adoquery1.Recordset,3,1);
//report.AutoSetUnboundFieldSource(crBMTName,???); 此句无法通过,不知道第二个参数是何变量,但在vb中可以省略该参数

crViewer1.ReportSource := Report;
crViewer1.ViewReport;
Crviewer1.Zoom(100);
各位帮帮忙
...全文
44 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhp97 2003-10-14
  • 打赏
  • 举报
回复
不行啊,哪个参数是万能变量OleVariant类型。我都试过了。
该函数可以参考如下:
report.AutoSetUnboundFieldSource(matchtype:ToleEnum;bindsubreports:OleVariant);
各位替我考虑下,真的很急啊
fs_windy 2003-10-14
  • 打赏
  • 举报
回复
Dephi函数省略参数可根据变量的类型, 选用nil或''代替

809

社区成员

发帖
与我相关
我的任务
社区描述
VB 多媒体
社区管理员
  • 多媒体
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧