建立了数据集dataset,并连接到了数据表C_All_Slaes_Con
主文件代码如下: 
protected void Page_Load(object sender, EventArgs e)
 {
        DataSet ds = new DataSet();    
        string select = Request.QueryString["sql"];
        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConSQL"]);
        SqlCommand sqlCmd = new SqlCommand(select, conn);
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = sqlCmd;
        da.Fill(ds, "C_All_Slaes_Con");        CrystalReportSource1.ReportDocument.Load(Server.MapPath("RmbxsReport.rpt"));
        CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables["C_All_Slaes_Con"]);
        CrystalReportSource1.DataBind();        CrystalReportViewer1.ReportSource = CrystalReportSource1;
        CrystalReportViewer1.DataBind();
}
报表文件RmbxsReport.rpt通过数据库专家加载了dataset,从数据库字段字拉出几个字段放在了报表中详细资料一栏.
调试时只显示报表框架,没有任何数据...,但数据库中数据是实事存在的,请教了...这问题搞好久了...

解决方案 »

  1.   

    调试,检查ds.Tables["C_All_Slaes_Con"])的数据是否存在
      

  2.   

    先看你是否真的查出数据了
    ds.Tables["C_All_Slaes_Con"])
      然后在看下!你报表内的绑定的字段是否和查出的字段 名相同.
      

  3.   

    参考:http://topic.csdn.net/u/20090420/14/d5e0a24b-3a55-4c4e-81bd-003c3c9b7605.html二楼
      

  4.   

    CrystalReportSource1.ReportDocument.Load(Server.MapPath("RmbxsReport.rpt")); 我看这里你的路径好像有问题。
    还有一般情况下如果你不想太麻烦的话,你完全可以用空间绑定报表,crystalReport它可以自动让你选择加载的报表,然后把加载的报表crystalReportViewer给它,绑定一下,让它显示就可以了。
      

  5.   

    还有可能是你的DataSet的问题,仔细检查一下DataSet,是不是有数据
      

  6.   

            DataSet ds = new DataSet();    
            string select = Request.QueryString["sql"]; 
            SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConSQL"]); 
            SqlCommand sqlCmd = new SqlCommand(select, conn); 
            SqlDataAdapter da = new SqlDataAdapter(); 
            da.SelectCommand = sqlCmd; 
            da.Fill(ds, "C_All_Slaes_Con");
     
            ReportDocument ReportDoc = new ReportDocument();
            ReportDoc.Load(Server.MapPath("RmbxsReport.rpt")); 
            ReportDoc.SetDataSource(ds.Tables["C_All_Slaes_Con"]);         CrystalReportViewer1.ReportSource = CrystalReportSource1; 具体的问题没看见整个代码也不好说是那错了啊..你把代码换成这样试试.如果还是不行的话.建议看看水晶报表的基础教程 从新设置一遍.rpt文件
      

  7.   

    数据库里面是否有数据? 你将DataSet  给GridView试试看
      

  8.   

    你先确定 你SQL语句查出数据了!  如果查出来了!你可以把代码贴到网上来!
      

  9.   

    搞定了...错误是接受    string select = Request.QueryString["sql"];  语句时,有一个%分丢失了,原因不明...多谢大家了
    例如原来要传的SQL是:SELECT * FROM C_All_Slaes_Con WHERE (SignTime LIKE '%08%')
    到新页面一接受就变成了:SELECT * FROM C_All_Slaes_Con WHERE (SignTime LIKE '08%')
    有谁能解释下么?没有不影响结贴,有最好啦.
    过一小时结贴.
      

  10.   

    //给报表指定数据源
    this.CrystalReportSource1.ReportDocument.SetDataSource(dtSource);
    this.CrystalReportSource1.Reflash();<body>
        <form id="form1" runat="server">
        <div>
            <div>
                <table style="width: 800px">
                    <tr>
                        <td style="width: 800px">
                            <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
                                DisplayGroupTree="False" HasPrintButton="True" HasToggleGroupTreeButton="False"
                                Height="790px" ReportSourceID="CrystalReportSource1" Width="1275px" />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 800px; text-align: center">
                        </td>
                    </tr>
                </table>
            </div>
        
        </div>
            <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
                <Report FileName="CryChargeInfo.rpt">
                </Report>
            </CR:CrystalReportSource>
        </form>
    </body>
      

  11.   

    select 则字段要与拉出来的表名一致。如果要显示left join 表中的字段,就必须要在第一个表增加相应字段,然后拖出来
      

  12.   

    你要建一张新表,表中的字段与left join 后得到的表一致。