zoukankan      html  css  js  c++  java
  • 水晶报表 Pull方式 数据库登录问题 解决方式1(推荐)

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

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

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

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

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

    1 public partial class _Default : System.Web.UI.Page
    2 {
    3         DataSet1 ds = new DataSet1();
    4 private ReportDocument myreport;
    5 protected void Page_Load(object sender, EventArgs e)
    6 {
    7             Button1_Click(sender, e);
    8         }
    9 protected void Button1_Click(object sender, EventArgs e)
    10 {
    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

  • 相关阅读:
    python面向对象(一)
    ls和cd命令详解
    SHELL 中的变量
    Shell基础
    Python版飞机大战
    Python模块制作
    Linux的cut命令
    Linux中的wc命令
    Ubuntu系统下adb devices 不能显示手机设备
    app耗电量测试工具--PowerTutor
  • 原文地址:https://www.cnblogs.com/chencidi/p/2272469.html
Copyright © 2011-2022 走看看