CrystalReportViewer1.ReportSource = New WebClient.localhost.StudentService()
这一行出错;
StudentService()是报表的类文件吧
建议你这样写:
WebClient.localhost.StudentService rpt1=new WebClient.localhost.StudentService();
report1.SetDataSource(ds);
CrystalReportViewer1.ReportSource=rpt1;以上ds为数据集。

解决方案 »

  1.   


    在运行时,只需填充数据集并通过SetDataSource 方法把填充后的数据集传到报表中即可。
    可以访问SetDataSource 方法的对象有两种。ReportDocument类是报表本身的封装;它把SetDataSource 作为一个方法加以访问。如果你的数据集包含了所有的表格并且它们与报表中的定义相吻合,那么你应该通过报表对象来调用SetDataSource 。通过报表对象同时也访问数据库属性,该数据库拥有表格集合。Table类同样也有SetDataSource 方法。你可以通过检索适当的表格、调用SetDataSource ,并传递数据集中适当记录的方法直接填写报表表格。