Stimulsoft_Report纯代码实现数据绑定

根据穿的参数动态绑定显示报表,涉及多表查询。

一、前台代码:

[code]  <%@ Page Title=""
Language="C#"
MasterPageFile="~/WebMaster/OpenWin_FixHead.Master"
AutoEventWireup="true" CodeBehind="ProjectReport.aspx.cs"
Inherits="HuaiNanSys.Page.ProjectInformation.ProjectReport" %>

<%@
register Namespace="Stimulsoft.Report.Web"
TagPrefix="cc1"  
Assembly="Stimulsoft.Report.Web"%>

<%@
register Namespace="Stimulsoft.Report.Web" TagPrefix="cc2"
Assembly="Stimulsoft.Report.WebDesign"%>

<asp:Content
ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">

</asp:Content>

<asp:Content
ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
runat="server">

<cc1:StiWebViewer
ID="StiWebViewer1" runat="server" GlobalizationFile="/Content/page/reports/Localization/zh-CHS.xml"
ShowDesignButton="False"
onreportdesign="StiWebViewer1_ReportDesign"
Theme="Office2010" BackColor="#e8e8e8"/>

<cc2:StiWebDesigner
ID="StiWebDesigner1" runat="server"
LocalizationDirectory="/Content/page/reports/Localization/"
Localization="zh-CHS" 
onsavereport="StiWebDesigner1_SaveReport" />

</asp:Content>

二、后台代码:

using Stimulsoft.Report;

using Stimulsoft.Report.Components;

using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace Page.ProjectInformation

{

public partial class ProjectReport :
BaseContentPage_UsingMaster

{

protected void Page_Load(object sender, EventArgs
e)

{

string RowGuid = Request.QueryString[“RowGuid”];

[code]        ShowReport(RowGuid);

}

public void ShowReport(string rowGuid)

{

DataSet ds = new DataSet();

MisGuidRow mis = new
MisGuidRow("View_ProjectInformation");

DataView dv = mis.Select("*",
"RowGuid='" + rowGuid + "'");

ds.Tables.Add(dv.ToTable());

string filepath =
Server.MapPath("~/Report.mrt");

StiReport stireport = new StiReport();

stireport.Load(filepath);

stireport.RegData("datasource", ds);

DataTable dt = ds.Tables[0];

StiDataBand D =
stireport.Pages[0].Components["DataBand1"] as StiDataBand;

StiText ProjectName =
D.Components["ProjectName"] as StiText;

ProjectName.Text =
Convert.ToString(dt.Rows[0]["ProjectName"]);

stireport.Compile();

StiWebViewer1.Report = stireport;

}

protected void
StiWebViewer1_ReportDesign(object sender,
Stimulsoft.Report.Web.StiReportDesignEventArgs e)

{

string filepath =
Server.MapPath("~/Report.mrt");

StiReport stireport = new StiReport();

stireport.Load(filepath);

stireport.Compile();

StiWebDesigner1.Design(stireport);

}

protected void
StiWebDesigner1_SaveReport(object sender,
Stimulsoft.Report.Web.StiWebDesigner.StiSaveReportEventArgs e)

{

var report = e.Report;

string filepath =
Server.MapPath("~/Report.mrt");

report.Save(filepath);

}

}

}

三、引用dll

四、在designer.exe中设计报表,只需要画出样式,不需要连接和绑定数据源

报表树结构如下:用的是text

Stimulsoft_Report纯代码实现数据绑定的更多相关文章

  1. 使用Java纯代码实现MySQL的连接

      建立数据库 1. 点击连接-->MySQL: 输入连接名 . 主机名/IP地址 .端口 .用户名.密码(没有密码就省略),然后点击确定,建立的表格是灰色表示关闭状态,双击开启 2. 重新创建 ...

  2. swift 之 纯代码创建 cell

    初学swift 但是网上只有很多swift用xib创建的cell,就算是有也不是我想要的.今天自己弄了一个不用xib纯代码写的,来上代码 博客地址: https://github.com/liguol ...

  3. Masonry -- 使用纯代码进行iOS应用的autolayout自适应布局

    简介 简化iOS应用使用纯代码机型自适应布局的工作,使用一种简洁高效的语法替代NSLayoutConstraints. 项目主页: Masonry 最新示例: 点击下载 项目简议: 如果再看到关于纯代 ...

  4. ios开发UI篇—使用纯代码自定义UItableviewcell实现一个简单的微博界面布局

    本文转自 :http://www.cnblogs.com/wendingding/p/3761730.html ios开发UI篇—使用纯代码自定义UItableviewcell实现一个简单的微博界面布 ...

  5. iOS开发小技巧--纯代码自定义cell

    纯代码自定义cell 自定义cell的步骤(每个cell的高度不一样,每个cell里面显示的内容也不一样) 1.新建一个继承自UITableViewCell的子类 2.在initWithStyle:方 ...

  6. ios - 纯代码创建collectionView

    开始考虑好一点点时间,因为一般的都是用xib,或者storyboard来写的.这次用纯代码...废话较多请看 首先把storyboard干掉,工程里面的main干掉 由于干掉了storyboard则启 ...

  7. 【iOS开发】多屏尺的自动适配 AutoLayout (纯代码方式)

    关于AutoLayout,最早从iOS6开始引入使用.   主要功能是使用约束,对视图进行相对布局,以适应不同屏尺的变换.   网上大量的资料都在介绍xib和storyboard,如何使用AutoLa ...

  8. IOS之UI--小实例项目--添加商品和商品名(纯代码终结版)

    前言:这个小实例项目是完完全全以MJ视频传授的优化方案一步一个思路从零开始敲出代码的,而且每一步都有思路,都有逻辑所以然.敲代码讲究思路,我个人不建议记忆太多东西,反正我记性很差的. 小贴士:文章末尾 ...

  9. iOS高仿app源码:纯代码打造高仿优质《内涵段子》

    iOS高仿app源码:纯代码打造高仿优质<内涵段子>收藏下来 字数1950 阅读4999 评论173 喜欢133 Github 地址 https://github.com/Charlesy ...

随机推荐

  1. 杂项-Tmod:常见错误提示

    ylbtech-杂项-Tmod:常见错误提示 1.返回顶部 1. The column 'Content' was specified multiple times for 'T'.select a. ...

  2. 抽象类 抽象方法 abstract

    abstract: * abstract修饰类: 抽象类 * > 此类不能被实例化 * > 抽象类中一定要有构造器, 便于子类对象实例时调用(涉及子类对象实例化过程) * > 开发中 ...

  3. Linux环境下对大小写敏感,linux环境升级node

    linux对大小写敏感 在window下可以正常运行的代码,在linux环境下报错,找不到文件,因为window下对大小写不敏感,linux对大小写敏感 linux环境下node升级 1.安装nvm ...

  4. [python面试题] 什么是单例,单例有什么用,业务场景是什么

    单例概念: 单例是一个特殊的类,这个类只能创建一次实例,例子如下: 1.a = Std(name='leo'), b = Std(name='jack'),两者的指向都是name=‘leo’的对象: ...

  5. Linux操作系统(二)_快速入门

    环境 安装VM ware,输入VM key 在VM上安装CentOS 6.5 设置网络,能在本机上ping通 通过终端连接工具:Xshell或SecureCRT,连接Linux服务器 实操可能出现的问 ...

  6. electron测试TCP通信

    这几天学习了一下Elctron,对于这个应用有了一点简单的认识,将这个过程记录一下. 首先,electron会加载main.js,在这里将整个程序启动,相当于其他程序的main函数了. 我是基于ele ...

  7. APP测试功能点

    1.使用APP时手机耗电情况 2.APP占用手机内存 3.APP在不同网络下的使用情况(WiFi/4G/3G/2G) 4.APP安装包大小 5.APP流量消耗 6.APP支持系统版本(android, ...

  8. Java并发Lock接口

    java.util.concurrent.locks.Lock接口用作线程同步机制,类似于同步块.新的锁定机制更灵活,提供比同步块更多的选项. 锁和同步块之间的主要区别如下: 序列的保证 - 同步块不 ...

  9. js数据处理-----数据拷贝

    一.理解深拷贝与浅拷贝 如下代码,把 a  的值赋给  b ,修改 b 的值会直接修改到  a 的值,这叫浅拷贝.(其实他们修改的是同一个对象) var a = [1,2,3,4,5]; var b ...

  10. PyQt5实战1-搭建conda环境

    一.安装Anaconda 下载地址:https://repo.anaconda.com/archive/Anaconda3-2019.03-Windows-x86_64.exe 软件版本:Anacon ...