【原创+分享】VS2005水晶报表PUSH模式(DataSet)视频教程+源代码工程示例

阿泰 2008-11-18 10:29:59
加精
昨天抽空做了下,因为总有事情打断,断断续续做了好几次,加上第一次正经做视频,所以有点乱。
而且为了便于压缩,没有出声,大家看着会有点费力,不过好在整个过程比较简单。

本示例包含:

单表模板演示
多表模板演示
子报表演示

基本涵盖了日常需求,按照此方式,也基本可满足基于水晶报表的日常开发,代码基本上可以不用操心了

视频+代码下载地址:

点击这里>>>>>>>>>>

压缩文件:6.4M,视频总长:26分钟左右。建议初学者仔细研读。

说明一下,因为我的工程文件里的报表版本是CR XI,所以你可能跑不起来,建议你自己按照视频重新构造一下。

如果视频中有说错的地方,还请大家多多指正。

请不要在本贴中问与主题无关的问题,谢谢
...全文
18344 318 打赏 收藏 转发到动态 举报
写回复
用AI写文章
318 条回复
切换为时间正序
请发表友善的回复…
发表回复
董事长Kevin 2012-09-07
  • 打赏
  • 举报
回复
还没下。真心谢过
董事长Kevin 2012-09-07
  • 打赏
  • 举报
回复
顶 顶
wwb562883398 2012-09-07
  • 打赏
  • 举报
回复
这个视频是拿什么软件录得啊
zp1201 2012-08-28
  • 打赏
  • 举报
回复
阿泰fans。。思密达
kankankankan2222 2012-03-26
  • 打赏
  • 举报
回复
还没看。真心谢过
jiajia_890605 2012-03-11
  • 打赏
  • 举报
回复
不好意思,我想请问一下,如何将水晶报表设计的部分与WINform窗体应用程序整合到一起,以达到普通用户能够直接用的效果……也不知道我的表述您能了解吗……
juiky 2012-03-07
  • 打赏
  • 举报
回复
谢谢了,有用
zhoukun6071 2012-02-28
  • 打赏
  • 举报
回复
强烈支持
al198865 2012-02-09
  • 打赏
  • 举报
回复
谢谢泰哥分享!
jxyga111 2012-01-02
  • 打赏
  • 举报
回复
阿泰水晶報表牛人
jilonglv 2011-12-24
  • 打赏
  • 举报
回复
不谢 真过意不去啊。。。。
custom1234 2011-11-10
  • 打赏
  • 举报
回复
lb90214 2011-11-10
  • 打赏
  • 举报
回复
阿泰,我遇到了一个问题,我给参数字段赋值了,可是点击打印的时候,它还是弹出赋值的框出来;代码如下://报表源绑定
private void ReportDataBind()
{
if (!checkDateTime())
{
return;
}
DataView SelectQuality = OracleHelper.ExecuteDataSet("select * from v_Qualtiy").Tables[0].DefaultView;
string strIsDisplayCal = "F";
if (SelectQuality.Count > 0)
{
strIsDisplayCal = SelectQuality[0][0].ToString().Trim();

}
string sqlStr = "";
string dateTime = Convert.ToDateTime(this.txtDate.Text).ToString("yyyy-MM-dd");
if (RBLDate.SelectedValue.Equals("ReachDate"))
{
sqlStr =string.Format(@"select substr(SampleDateTime,1,10) AS SampleDateTime,substr(MAVTestDatetime,1,10) AS MAVTestDatetime,s.transmode, b.coalbreed_name, c.coal_name, t.station_name, CarCount, SendWeight, ReceiveWeight, Mar, Mad, Aad, Ad, Vad, Vdaf, Stad, Std, FCad, Qb, Qgrad, Qgrd, Qnetar, cast(round(Qnetar*239.1429,0) as int) as Cal, c.Coal_Name
from t_Quality q join t_samplemakecode s on q.thirdcode=s.thirdcode join t_CoalName c on c.coal_code=s.coal_code join t_station t on t.station_code=s.station_code join t_coalkind c on c.coal_code=s.coal_code join t_coalbreed b on b.coalbreed_code=s.coalbreed_code where substr({0},1,10)='{1}' and q.auditlastf = 'T' and s.comparef = 'T'
order by TransMode, c.coal_name",RBLDate.SelectedValue,dateTime);
}
else
{
sqlStr =string.Format(@"select substr(SampleDateTime,1,10) AS SampleDateTime,substr(MAVTestDatetime,1,10) AS MAVTestDatetime,s.transmode, b.coalbreed_name, c.coal_name, t.station_name, CarCount, SendWeight, ReceiveWeight, Mar, Mad, Aad, Ad, Vad, Vdaf, Stad, Std, FCad, Qb, Qgrad, Qgrd, Qnetar, cast(round(Qnetar*239.1429,0) as int) as Cal, c.Coal_Name
from t_Quality q join t_samplemakecode s on q.thirdcode=s.thirdcode join t_CoalName c on c.coal_code=s.coal_code join t_station t on t.station_code=s.station_code join t_coalkind c on c.coal_code=s.coal_code join t_coalbreed b on b.coalbreed_code=s.coalbreed_code where substr(FirstCode,1,8)='{0}' and q.auditlastf = 'T' and s.comparef = 'T'order by TransMode, c.coal_name", dateTime.Replace("-", ""));

}
DataSet ds = OracleHelper.ExecuteDataSet(sqlStr);
//连接报表文件
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CR_QualityDay.rpt"));

CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.ReportDocument.ParameterFields["Year"].CurrentValues.AddValue(txtDate.Text.Substring(0, 4));
CrystalReportSource1.ReportDocument.ParameterFields["month"].CurrentValues.AddValue(txtDate.Text.Substring(5, 2));
CrystalReportSource1.ReportDocument.ParameterFields["Date"].CurrentValues.AddValue(txtDate.Text.Substring(8, 2));
//CrystalReportSource1.ReportDocument.ParameterFields["ptitle"].CurrentValues.AddValue("华 电 国 际 漯 河 发 电 厂");
CrystalReportSource1.ReportDocument.ParameterFields["title"].CurrentValues.AddValue("入 厂 煤 化 验 日 报");
CrystalReportSource1.ReportDocument.ParameterFields["Maker"].CurrentValues.AddValue(strUserName);
GetDataCount("0");
GetDataCount("1");

CrystalReportSource1.ReportDocument.ParameterFields["truckCoalCount"].CurrentValues.AddValue(truckCoalCount);
CrystalReportSource1.ReportDocument.ParameterFields["carCoalCount"].CurrentValues.AddValue(carCoalCount);
CrystalReportSource1.ReportDocument.ParameterFields["receiveTruckCount"].CurrentValues.AddValue(truckReceiveCount);
CrystalReportSource1.ReportDocument.ParameterFields["receiveCarCount"].CurrentValues.AddValue(carReceiveCount);
CrystalReportSource1.ReportDocument.ParameterFields["truckCarCount"].CurrentValues.AddValue(truckCount);
CrystalReportSource1.ReportDocument.ParameterFields["carCarCount"].CurrentValues.AddValue(carCount);
CrystalReportSource1.ReportDocument.ParameterFields["coalCount"].CurrentValues.AddValue(coalCount);
CrystalReportSource1.ReportDocument.ParameterFields["receiveCount"].CurrentValues.AddValue(receiveCount);

CrystalReportSource1.DataBind();

CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
}

private int truckCoalCount = 0;//火车矿数
private int carCoalCount = 0;//汽车矿数
private double truckReceiveCount = 0.00;//火车来煤验收量
private double carReceiveCount = 0.00;//汽车来煤验收量
private int coalCount = 0;//矿数
private double receiveCount = 0.00;//总验收量
private int carCount = 0;//汽车来煤车数
private int truckCount = 0;//火车来煤车数

private void GetDataCount(string transMode)
{
string sql = "";
string dateTime = Convert.ToDateTime(this.txtDate.Text).ToString("yyyy-MM-dd");
if (RBLDate.SelectedValue.Equals("ReachDate"))
{
sql = "select count(Coal_Code) as coalCount,sum(ReceiveWeight) as ReceiveWeight,sum(CarCount) as CarCount from t_Quality t join t_samplemakecode s on t.thirdcode=s.thirdcode where transMode = '0' and substr(ReachDate,1,10) = '"+txtDate.Text+"' and t.auditlastf = 'T' and s.comparef = 'T'";
}
else
{
sql = "select count(Coal_Code) as coalCount,sum(ReceiveWeight) as ReceiveWeight,sum(CarCount) as CarCount from t_Quality q left join t_samplemakecode s on q.thirdcode=s.thirdcode where transMode = '" + transMode + "' and substr(FirstCode,1,8) = '" + dateTime.Replace("-", "") + "' and auditlastf = 'T' and s.comparef = 'T'";
}
DataView dv = OracleHelper.ExecuteDataSet(sql).Tables[0].DefaultView;
if (transMode == "0")
{
if (dv.Table.Rows[0]["coalCount"].ToString() != "")
{
truckCoalCount = Convert.ToInt32(dv.Table.Rows[0]["coalCount"].ToString());
}
if (dv.Table.Rows[0]["ReceiveWeight"].ToString() != "")
{
truckReceiveCount = Double.Parse(dv.Table.Rows[0]["ReceiveWeight"].ToString());
}
if (dv.Table.Rows[0]["CarCount"].ToString() != "")
{
truckCount = Convert.ToInt32(dv.Table.Rows[0]["CarCount"].ToString());
}
coalCount += truckCoalCount;
receiveCount += truckReceiveCount;
}
else
{
if (dv.Table.Rows[0]["coalCount"].ToString() != "")
{
carCoalCount = Convert.ToInt32(dv.Table.Rows[0]["coalCount"].ToString());
}
if (dv.Table.Rows[0]["ReceiveWeight"].ToString() != "")
{
carReceiveCount = Double.Parse(dv.Table.Rows[0]["ReceiveWeight"].ToString());
}
if (dv.Table.Rows[0]["CarCount"].ToString() != "")
{
carCount = Convert.ToInt32(dv.Table.Rows[0]["CarCount"].ToString());
}
coalCount += carCoalCount;
receiveCount += carReceiveCount;
}
}
panxunmiao1 2011-11-02
  • 打赏
  • 举报
回复
好人那,感激涕零
zhangyajun0723 2011-10-18
  • 打赏
  • 举报
回复
谢谢分享~
cywmxrfzl 2011-10-10
  • 打赏
  • 举报
回复
这个教程怎么下载不了呢?
li367321 2011-09-30
  • 打赏
  • 举报
回复
qiu积分···
山东蓝鸟贵薪 2011-09-19
  • 打赏
  • 举报
回复
谢谢分享,顶一下
ecdyf1989 2011-09-18
  • 打赏
  • 举报
回复
谢谢楼主 正在看您写的文章
zhouyangmgzx 2011-09-15
  • 打赏
  • 举报
回复
慢慢学习
加载更多回复(292)

4,816

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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