水晶报表怎么动态调用数据据源呢? 先声明一个CrystalReport 的对象和DataSet 对象用SqlDataAdapter 的fill 方法填充DataSet 后将Dataset 绑定到CrystalReport ,用SetDataSource()方法即可,如果你想再绑定到查看器上crystalreportviewer1.ReportSource=CrystalReport对象 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给个例子吧,[email protected] this.dbCnn=new SqlConnection(Base.Connectstring);this.dbCnn.Open();this.dbAdp=new SqlDataAdapter(sqlString,this.dbCnn);this.rptDs=new DataSet();this.dbAdp.Fill(this.rptDs,"V_BillService");this.SvcbillRpt=new Bill_rpt();this.SvcbillRpt.SetDataSource(this.rptDs);this.crv_main.ReportSource=this.SvcbillRpt;this.crv_main.DisplayGroupTree=false;其中,你报表设计的字段一定要与你sqlString 的字段 对应我想这样已经够清楚了吧! 有几个问题:Bill_rpt(); //是什么东西?SvcbillRpt //就是那个报表控件名称?crv_main //那这个是什么呢?查看器 //是什么?还有其它的什么器吗?我第一次使用,请详细点,把上面的问题说一下,就基本清楚了。 哈,我来猜谜语Bill_rpt(); //是什么东西? //是他做的报表的一个实例SvcbillRpt //就是那个报表控件名称?//是他在类里定义的类型为莫一已知报表的变量crv_main //那这个是什么呢? //是CrystalReportViewer吧 ReportDocument Rd = new ReportDocument();Rd.Load ("C:\\Inetpub\\wwwroot\\crm_vss02\\orgMng\\CRpt_khxx.rpt");/* 或则直接创建一个报表实例 your_crystalReport Rd=new your_crystalReport();*/TableLogOnInfo logOnInfo = new TableLogOnInfo ();logOnInfo.ConnectionInfo.ServerName ="ServerName"; //你自己的服务器名logOnInfo.ConnectionInfo.DatabaseName = "DBName"; //你自己的数据库名logOnInfo.ConnectionInfo.UserID ="UserName";//数据库用户名logOnInfo.ConnectionInfo.Password ="PassWord";//密码for(int i=0;i<Rd.Database.Tables.Count;i++){ Rd.Database .Tables [i].ApplyLogOnInfo (logOnInfo);}this.CrystalReportViewer1.ReportSource= Rd; 看来我今天得查查黄历!模糊查询问题 comboBox选项改变如何获取之前的选项? 100分 word 打印试卷 手动最小化程序但是无法降低内存的使用 如何一直保留从url传来的变量? 关于正则表达式 请问如何获得屏幕的分辨率及相对于Winform的鼠标的坐标。 两个下拉框的联动的逻辑问题,求大神解答 我要被c#搞疯了!!!刚刚连上oracle的数据库,不做任何修改退出,再打开就死活连不上了!!! WPF中按钮的属性(properties)在哪里? 什么问题!请高手解决一下! 请教各位,Windows程序中如何从文件中读取jpg文件并存入oracle数据库中!
this.dbAdp=new SqlDataAdapter(sqlString,this.dbCnn);
this.rptDs=new DataSet();
this.dbAdp.Fill(this.rptDs,"V_BillService");
this.SvcbillRpt=new Bill_rpt();
this.SvcbillRpt.SetDataSource(this.rptDs);
this.crv_main.ReportSource=this.SvcbillRpt;
this.crv_main.DisplayGroupTree=false;其中,你报表设计的字段一定要与你sqlString 的字段 对应我想这样已经够清楚了吧!
SvcbillRpt //就是那个报表控件名称?
crv_main //那这个是什么呢?
查看器 //是什么?还有其它的什么器吗?我第一次使用,请详细点,把上面的问题说一下,就基本清楚了。
SvcbillRpt //就是那个报表控件名称?//是他在类里定义的类型为莫一已知报表的变量
crv_main //那这个是什么呢? //是CrystalReportViewer吧
Rd.Load ("C:\\Inetpub\\wwwroot\\crm_vss02\\orgMng\\CRpt_khxx.rpt");
/* 或则直接创建一个报表实例
your_crystalReport Rd=new your_crystalReport();
*/TableLogOnInfo logOnInfo = new TableLogOnInfo ();
logOnInfo.ConnectionInfo.ServerName ="ServerName"; //你自己的服务器名
logOnInfo.ConnectionInfo.DatabaseName = "DBName"; //你自己的数据库名
logOnInfo.ConnectionInfo.UserID ="UserName";//数据库用户名
logOnInfo.ConnectionInfo.Password ="PassWord";//密码
for(int i=0;i<Rd.Database.Tables.Count;i++)
{
Rd.Database .Tables [i].ApplyLogOnInfo (logOnInfo);
}
this.CrystalReportViewer1.ReportSource= Rd;