水晶报表 Pull方式 数据库登录问题 解决方式1(推荐)

Push 方式为水晶报表 将类或对象 做为水晶报表的 数据结构源.

 

Pull 为用水晶报表直接连接数据库, 存储过程==, 来获取数据结构源

 

The report you requested requires further information. 一种解决方案 

 

这个问题折磨了我一天,坐的我屁股疼。

问这个问题的人很多,不知道是否适用,仅供参考哈。

1 public partial class _Default : System.Web.UI.Page
2 dot.gif{
3         DataSet1 ds = new DataSet1();
4 private ReportDocument myreport;
5 protected void Page_Load(object sender, EventArgs e)
6 dot.gif{
7             Button1_Click(sender, e);
8         }
9 protected void Button1_Click(object sender, EventArgs e)
10 dot.gif{
11             myreport = new ReportDocument();
12 string reportPath = Server.MapPath("CrystalReport.rpt");
13             myreport.Load(reportPath);
14
15
16 string strProvider = "server=localhost;packet size=4096;user id=XXX;initial catalog=XXX;persist security info=True;password=XXXX";
17             SqlConnection MyConn = new SqlConnection(strProvider);
18             MyConn.Open();
19 string strSel = "Select a.bookno,a.cname,b.gname from [order] a,orderdetail b where a.bookno = b.bookno";
20             SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel, MyConn);
21             DataSet ds = new DataSet();
22             MyAdapter.Fill(ds, "DataTable1");
23             myreport.SetDataSource(ds);
24
25             Viewer.ReportSource = myreport;
26         }
27
28 }
29

注意MyAdapter.Fill(ds, "DataTable1"); 这里的DataTable1必须与创建的Dataset1中的表名相同,否则会出现

The report you requested requires further information 信息。写成MyAdapter.Fill(ds);也不行。

 

祝好运!

 

如果为存储过程的话, 会在存储过程后面加上一个 ;1

image
image

 

 

 

引用:http://www.cnblogs.com/silentwater/articles/760593.html

转载于:https://www.cnblogs.com/chencidi/archive/2011/12/02/2272469.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值