我有一个水晶报表打开文档时,给了我未定义的错误,没有任何一个遇到这种类型的错误,下面是编码:Crystal报表十一+ C#.NET文档加载问题
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
///create instance of class first
ReportDocument rpDoc = new ReportDocument();
///load the report
rpDoc.Load(@"TicketingBasic.rpt");////------->>>problem is here
///pass the report to method for dataInfo
getDBInfo(rpDoc);
/// et the source for report to be displayed
CrystalReportViewer1.ReportSource = rpDoc;
}
protected static void getDBInfo(ReportDocument rpDoc)
{
///Connection Onject
ConnectionInfo cn = new ConnectionInfo();
///DataBase,Table, and Table Logon Info
Database db;
Tables tbl;
TableLogOnInfo tblLOI;
///Connection Declaration
cn.ServerName = "???????????";
cn.DatabaseName = "??????????";
cn.UserID = "?????????";
cn.Password = "????????????";
//table info getting from report
db = rpDoc.Database;
tbl = db.Tables;
///for loop for all tables to be applied the connection info to
foreach (Table table in tbl)
{
tblLOI = table.LogOnInfo;
tblLOI.ConnectionInfo = cn;
table.ApplyLogOnInfo(tblLOI);
table.Location = "DBO." + table.Location.Substring(table.Location.LastIndexOf(".") + 1);
}
db.Dispose();
tbl.Dispose();
}
}
决赛代码片段是:
rpDoc.Load(Server.MapPath(@"TicketingBasic.rpt"));
谢谢大家的帮助。
我现在遇到的问题是报告不打印或导出到其它类型,如.PDF,的.xsl,.DOC等任何线索
我现在遇到的问题是报告没有打印或导出到其他类型,如.pdf,.xsl,.doc等,任何线索 – Developer 2009-08-06 16:04:17
如果您在page_init中加载报告,会发生什么情况? – dotjoe 2009-08-07 02:01:55
+1当接受的答案没有得到赞扬时,这个人会杀死我。最近发生在我身上的两次。 – Dusty 2009-08-13 18:17:00