没有合适的资源?快使用搜索试试~ 我知道了~
VS-VB--水晶报表数据库连接
4星 · 超过85%的资源 需积分: 10 7 下载量 174 浏览量
2013-07-15
17:03:04
上传
评论
收藏 2KB TXT 举报
温馨提示
试读
3页
分享资源:整个演示的操作过程说明: 1、 在解决方案资源管理器里,你需要存放报表文件处,添加新项:CrystalReport报表,起名为cr1.rpt 2、 在随后出现的“报表专家”中选择数据源时,请务必选择OLE DB,然后根据你的数据库的要求选择响应的驱动引擎:
资源推荐
资源详情
资源评论
最终修改如下:(完整代码)数据库为sql server2000
using CrystalDecisions.Shared ;//负责解释TableLogOnInfo类
using CrystalDecisions.CrystalReports .Engine ;//负责解释ReportDocument类
private void Page_Load(object sender, System.EventArgs e)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
//这里必须事先申明一个ReportDocument对象 Report,同时加载数据报表
ReportDocument oRpt = new ReportDocument();
//获取.rpt文件真实路径
string path1,path2;
path1=Server.MapPath ("\\exer\\pagelet");
path2=path1+"\\crystal\\cr1.rpt";
//oRpt.Load("c:\\inetpub\\wwwroot\\exer\\pagelet\\crystal\\cr1.rpt");
oRpt.Load (path2);
//从web.config中获取logOnInfo参数信息
string a,b,c,d;
//获取ServerName
a=System.Configuration .ConfigurationSettings .AppSettings ["servername"];
//获取DatabaseName
b=System.Configuration .ConfigurationSettings .AppSettings ["database"];
//获取UserId
c=System.Configuration .ConfigurationSettings .AppSettings ["userid"];
//获取password
d=System.Configuration .ConfigurationSettings .AppSettings ["pass"];
//设置logOnInfo参数
logOnInfo.ConnectionInfo.ServerName = a;
logOnInfo.ConnectionInfo.DatabaseName = b;
logOnInfo.ConnectionInfo.UserID = c;
using CrystalDecisions.Shared ;//负责解释TableLogOnInfo类
using CrystalDecisions.CrystalReports .Engine ;//负责解释ReportDocument类
private void Page_Load(object sender, System.EventArgs e)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
//这里必须事先申明一个ReportDocument对象 Report,同时加载数据报表
ReportDocument oRpt = new ReportDocument();
//获取.rpt文件真实路径
string path1,path2;
path1=Server.MapPath ("\\exer\\pagelet");
path2=path1+"\\crystal\\cr1.rpt";
//oRpt.Load("c:\\inetpub\\wwwroot\\exer\\pagelet\\crystal\\cr1.rpt");
oRpt.Load (path2);
//从web.config中获取logOnInfo参数信息
string a,b,c,d;
//获取ServerName
a=System.Configuration .ConfigurationSettings .AppSettings ["servername"];
//获取DatabaseName
b=System.Configuration .ConfigurationSettings .AppSettings ["database"];
//获取UserId
c=System.Configuration .ConfigurationSettings .AppSettings ["userid"];
//获取password
d=System.Configuration .ConfigurationSettings .AppSettings ["pass"];
//设置logOnInfo参数
logOnInfo.ConnectionInfo.ServerName = a;
logOnInfo.ConnectionInfo.DatabaseName = b;
logOnInfo.ConnectionInfo.UserID = c;
资源评论
- x20121192014-05-23用不了,可能环境不对吧,调试好久不行
- Aquarise2013-11-15完全不明白这是怎么一回事
feiyangz2010
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功