放分300分,帮分析一下关于水晶报表的出错问题,不要将本论坛的置顶代码贴过来!!!!
我将在开两贴,望高手前来领分!!!!
源代码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using System.Runtime.InteropServices;
namespace jsj
{
/// <summary>
/// print 的摘要说明。
/// </summary>
public class print : System.Web.UI.Page
{
protected config con=new config();
protected CrystalDecisions.Web.CrystalReportViewer crpt;
protected jsj.dsall ds;
protected System.Data.SqlClient.SqlDataAdapter da;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
string sqlstr=Session["sqlstr"].ToString();//测试无误
ReportDocument cr=new ReportDocument();
//cr.Load(Server.MapPath("sbprint.rpt"));
cr.Load("c:\\inetpub\\wwwroot\\jsj\\sbprint.rpt");
con.open();
da = new SqlDataAdapter(sqlstr,con.link);
//建立.rpt文件与CryStalReportviewer文件之间的连接
da.Fill(ds);
cr.SetDataSource(ds.Tables[0]);
crpt.ReportSource=cr;
crpt.DataBind();
con.Close();
}
}
}
出错信息如下:
“/jsj”应用程序中的服务器错误。
--------------------------------------------------------------------------------
文件 c:\inetpub\wwwroot\jsj\sbprint.rpt 内出错:无效表号。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息:
CrystalDecisions.CrystalReports.Engine.InvalidArgumentException: 文件
c:\inetpub\wwwroot\jsj\sbprint.rpt 内出错:无效表号。
源错误:
行 46:
行 47: da.Fill(ds);
行 48: cr.SetDataSource(ds.Tables[0]);
行 49: crpt.ReportSource=cr;
行 50:
源文件: c:\inetpub\wwwroot\jsj\print.aspx.cs 行: 48
--------------------------
dsall.xsd是我建的数据集,我将数据表从“服务器资源管理器”里从“数据连接”里面测试成功的连接里将数据表cequips拖拽出来的。
这个无效表号是什么意思?