感谢您使用微软产品。问题可能出现在如下几个方面:
(1)设计的报表文件CrystalReport1的Details(Section 3)中,没有放置来自DataSet的数据表字段;需要将显示在报表中字段从DataSet中拖放到报表文件中,其中Page Header(Section 2)中显示字段标题,而Details(Section 3)中显示字段内容;
(2)进一步确认将数据填充到DataSet中,否则也会出现这种情况;
(3)还必须确认DataSet中的相应的table中有数据,并且请主要中填充DataSet时,使用的表名应该如DataSet1.xsd中的表名一致,否则也会出现这种情况;
如下面示例代码:
……
        Dim myDS As New Dataset1()
‘这里的authors应该与数据库文件pubs中数据表authors的表名一致,因为一般我们是直接将数据表authors拖放到DataSet1.xsd中。
        myDA.Fill(myDS, "authors")
        Dim oRpt As New CrystalReport1()
        oRpt.SetDataSource(myDS)
        CrystalReportViewer1.ReportSource = oRpt
……
如果仍然存在问题,请将您的代码贴出来。
Hope this is helpful! — 微软全球技术中心 VB支持中心本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。

解决方案 »

  1.   

    问题很清楚,连接pubs数据库中的authors表没的问题。
    我用相同代码做我自己建的数据就有问题了
    代码如下:(C#)
    SqlConnection myConnection = new SqlConnection("server=localhost;database=ztgsgl;uid=sa;pwd=");
    SqlDataAdapter myCommand = new SqlDataAdapter("select * from SH_QYJDGL_NJJG", myConnection); DataSet1 ds = new  DataSet1();
    myCommand.Fill(ds, "Stores"); CrystalReport1 oRpt = new CrystalReport1(); oRpt.SetDataSource(ds); CrystalReportViewer1.ReportSource = oRpt;
    CrystalReportViewer1.DataBind ();