水晶报表中不需要填写登陆信息实现
来源:互联网 发布:log4cpp 网络传输 编辑:程序博客网 时间:2024/06/02 04:21
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using CrystalDecisions.CrystalReports.Engine;//负责解释ReportDocument类
using CrystalDecisions.Shared;//负责解释tableLogOninfo类
namespace WV
{
public partial class reportFrame : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
login log = new login();
DataSet ds = new DataSet();
string strSql = string.Format(@"select a.customerid,a.name,a.sex,b.enddt from base_customers a join kqxt_leave b on a.customerid=b.customerid where rownum<50");
ds = log.Query(strSql);//获取数据源
ReportDocument rd = new ReportDocument();
//获取报表路径
string reportPath = Server.MapPath("reportFolder/report.rpt");
rd.Load(reportPath);
rd.SetDataSource(ds);
//添加登录信息
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo.ServerName = "数据库名";
logOnInfo.ConnectionInfo.DatabaseName = "";
logOnInfo.ConnectionInfo.UserID = "用户名";
logOnInfo.ConnectionInfo.Password = "密码";
rd.Database.Tables[0].ApplyLogOnInfo(logOnInfo);
CrystalReportViewer1.ReportSource = rd;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using CrystalDecisions.CrystalReports.Engine;//负责解释ReportDocument类
using CrystalDecisions.Shared;//负责解释tableLogOninfo类
namespace WV
{
public partial class reportFrame : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
login log = new login();
DataSet ds = new DataSet();
string strSql = string.Format(@"select a.customerid,a.name,a.sex,b.enddt from base_customers a join kqxt_leave b on a.customerid=b.customerid where rownum<50");
ds = log.Query(strSql);//获取数据源
ReportDocument rd = new ReportDocument();
//获取报表路径
string reportPath = Server.MapPath("reportFolder/report.rpt");
rd.Load(reportPath);
rd.SetDataSource(ds);
//添加登录信息
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo.ServerName = "数据库名";
logOnInfo.ConnectionInfo.DatabaseName = "";
logOnInfo.ConnectionInfo.UserID = "用户名";
logOnInfo.ConnectionInfo.Password = "密码";
rd.Database.Tables[0].ApplyLogOnInfo(logOnInfo);
CrystalReportViewer1.ReportSource = rd;
}
}
}
阅读全文
0 0
- 水晶报表中不需要填写登陆信息实现
- 水晶报表中不需要填写登陆信息实现
- 水晶报表设置登陆数据库信息
- 彻底解决水晶报表中登陆的错误
- vs2005中水晶报表实现
- vs2005中水晶报表实现
- vs2005中水晶报表实现
- 水晶报表登陆简介
- 在JSP中实现水晶报表
- 水晶报表--数据库登陆问题
- 水晶报表--数据库登陆问题
- 整理的水晶报表信息
- 水晶报表技术(3)——.NET 2005 中动态水晶报表的实现
- 水晶报表进行每页统计(在水晶报表中实现每页统计)
- 一起学习水晶报表之拉模式【如何实现水晶报表显示数据信息】(课程3)
- 水晶报表登陆问题并生成PDF
- 水晶报表登陆错误的困惑
- 取消水晶报表的数据库登陆框
- 学习笔记——S2SH框架整合
- 责任链模式
- 关于nginx服务器关于https的配置文件
- 26. 编写函数:删除一个字符串中的所有空格。
- Activity启动模式和栈退出应用程序
- 水晶报表中不需要填写登陆信息实现
- SmartImageView
- 算法复习笔记
- Oracle RAC添加新表空间时数据文件误放置到本地文件系统的修正
- 122. Best Time to Buy and Sell Stock II
- 测试开发成长学习路线--引导篇
- Iamge组件
- [分块] BZOJ 4867 [Ynoi2017]舌尖上的由乃
- mysql基础知识(笔记)