Cystal与VS2005和SQL 2005 ... [英] Cystal with VS2005 and SQL 2005...

查看:67
本文介绍了Cystal与VS2005和SQL 2005 ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚从.Net 1.1迁移到.Net 2.0。

I just moved from .Net 1.1 to .Net 2.0.

报告之前是9.x我现在看到ide使用10.x

The reports were 9.x before now I see the ide using 10.x

我的报告无法正常工作。

My reports do not work as they used to work.

这是使用的代码段工作....

This is the piece of code the used to work....

rpt.Load(reportSource + @" \ AuditLog \" + reportConfig.ReportName);

rpt.Load(reportSource + @"\AuditLog\" + reportConfig.ReportName);

// rpt.SetDataSource(" fsp_AuditLogReport_Get; 1");

//rpt.SetDataSource("fsp_AuditLogReport_Get;1");

addReportParameter(rpt, " @ EntryDtFrom" ,reportConfig.fromDate.ToString( " G" ));

addReportParameter(rpt, "@EntryDtFrom", reportConfig.fromDate.ToString("G"));

addReportParameter(rpt, " @ EntryDtTo" ,reportConfig.toDate.ToString( " G" ));

addReportParameter(rpt, "@EntryDtTo", reportConfig.toDate.ToString("G"));

if (reportConfig.UserID!= null && reportConfig.UserID!= ""

if (reportConfig.UserID!=null && reportConfig.UserID!="")

addReportParameter(rpt , " @ UserId" ,reportConfig.UserID);

addReportParameter(rpt, "@UserId", reportConfig.UserID);

addReportParameter (rpt, " @ Application" ,(reportConfig.AppName == null || reportConfig.AppName == "" < font size = 2>)? "%" :reportConfig.AppName);

addReportParameter(rpt, "@Application", (reportConfig.AppName==null || reportConfig.AppName=="") ? "%" : reportConfig.AppName);

if (reportConfig.EnvironmentName!= null && reportConfig.EnvironmentName!= ""

if (reportConfig.EnvironmentName!=null && reportConfig.EnvironmentName!="")

addReportParameter(rpt, " @ EnvironmentName" ,reportConfig.EnvironmentName);

addReportParameter(rpt, "@EnvironmentName", reportConfig.EnvironmentName);

if (reportConfig.SPName!= null && reportConfig.SPName!= ""

if (reportConfig.SPName!=null && reportConfig.SPName!="")

addReportParameter(rpt , " @ SnapInName" ,reportConfig.SPName);

addReportParameter(rpt, "@SnapInName", reportConfig.SPName);

addReportParameter (rpt, " @ MessageName" ,(reportConfig.MessageName == null )? "%" :reportConfig.MessageName);

addReportParameter(rpt, "@MessageName", (reportConfig.MessageName==null) ? "%" : reportConfig.MessageName);

#region 设置数据库连接到Communicator数据库

#region set up database connection to Communicator database

ParseDBConnForKey(dbConComm, out serverName, out 数据库, out userid, out 密码);

ParseDBConnForKey(dbConComm, out serverName, out database, out userid, out password);

logonInfo = new TableLogOnInfo ();

logonInfo = new TableLogOnInfo();

logonInfo.ConnectionInfo.ServerName = serverName;

logonInfo.ConnectionInfo.ServerName = serverName;

logonInfo.ConnectionInfo.DatabaseName = database;

logonInfo.ConnectionInfo.DatabaseName = database;

logonInfo.ConnectionInfo.UserID = userid;

logonInfo.ConnectionInfo.UserID = userid;

logonInfo.ConnectionInfo.Password = password;

logonInfo.ConnectionInfo.Password = password;

for int n = 0; n< rpt.Database.Tables.Count; n ++)

for (int n = 0; n < rpt.Database.Tables.Count; n++)

{

rpt.Database.Tables.ApplyLogOnInfo(logonInfo);

rpt.Database.Tables.ApplyLogOnInfo(logonInfo);

rpt.Database .Tables.Location = database + " .dbo。"

rpt.Database.Tables.Location = database + ".dbo."

+ rpt.Database.Tables.Location.Substring(rpt.Database.Tables.Location.LastIndexOf( "。" )+ 1);

+ rpt.Database.Tables.Location.Substring(rpt.Database.Tables.Location.LastIndexOf(".") + 1);

}

#endregion

#endregion

// rpt.Refresh();

//rpt.Refresh();

// rpt.VerifyDatabase();

//rpt.VerifyDatabase();

//导出报告

// Export the report

rpt.ExportToDisk( ExportFormatType .PortableDocFormat,fullPath);

rpt.ExportToDisk(ExportFormatType.PortableDocFormat, fullPath);

*****************

*****************

私人 void addReportParameter( ReportDocument rpt, string param, string val)

private void addReportParameter(ReportDocument rpt, string param, string val)

{

if (val!= null && val!= ""

if (val != null && val != "")

{

ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue ();

ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

crParameterDiscreteValue.Value = val;

crParameterDiscreteValue.Value = val;

ParameterValues CrParaVals = rpt.DataDefinition.ParameterFields [param] .CurrentValues;

ParameterValues CrParaVals = rpt.DataDefinition.ParameterFields[param].CurrentValues;

CrParaVals.Add(crParameterDiscreteValue);

CrParaVals.Add(crParameterDiscreteValue);

rpt.DataDefinition.ParameterFields [param] .ApplyCurrentValues(CrParaVals);

rpt.DataDefinition.ParameterFields[param].ApplyCurrentValues(CrParaVals);

}

}

******** *********

*****************

现在我得到了......

now i get a ...

异常类型名称= FormulaException
异常编号=
异常消息=此字段名称未知。
文件C中的错误:\ DOCUME~1 \ kondursx \ LOCALS~1 \Temp \ auditlog {D872CC24-4C12-4543-B75A-EEFDC3FECD38} .rpt:
公式中的错误< DateToConverted>。
'DateAdd(" h",DateDiff(" h",{fsp_serverLocalTime; 1.SqlLocalTime},CurrentDateTime), {?@ EntryDtTo})'
此字段名称未知。
Exception Trace = at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
在CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
在CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
在CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType,String fileName)
位于C:\ Communicator \ Base \7.2 \ Service中的Fiserv.CBS.Communicator.Tasks.ReportManagerTask.ReportGenerator.generateReport()提供商\源代码\ ReportManagerTa sk\ReportGenerator.cs:第226行
位于C:\ Communicator \ Base \7.2 \ Service Providers \ Source Code中的Fiserv.CBS.Communicator.Tasks.ReportManagerTask.ReportManagerTask.OnRun(Guid msgGuid) \ ReportManagerTask \ ReportManagerTask.cs:第126行

   Exception Type Name = FormulaException
   Exception Number =
   Exception Message = This field name is not known.
Error in File C:\DOCUME~1\kondursx\LOCALS~1\Temp\auditlog {D872CC24-4C12-4543-B75A-EEFDC3FECD38}.rpt:
Error in formula  <DateToConverted>.
'DateAdd ("h", DateDiff ("h", {fsp_serverLocalTime;1.SqlLocalTime}, CurrentDateTime), {?@EntryDtTo})'
This field name is not known.
   Exception Trace =    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)
   at Fiserv.CBS.Communicator.Tasks.ReportManagerTask.ReportGenerator.generateReport() in C:\Communicator\Base\7.2\Service Providers\Source Code\ReportManagerTask\ReportGenerator.cs:line 226
   at Fiserv.CBS.Communicator.Tasks.ReportManagerTask.ReportManagerTask.OnRun(Guid msgGuid) in C:\Communicator\Base\7.2\Service Providers\Source Code\ReportManagerTask\ReportManagerTask.cs:line 126

该报告使用2个存储的预备。我是水晶新手,所以请耐心等待。

The report uses 2 stored preedures. Am new to crystal so bear with me here.

代码中的一些注释内容是我试过的到目前为止没有太多运气。当我做了refreesh时,我看到Prameter值刚刚消失了。

Some the commented stuff in the code is what i have tried so far with not much luck. When i did the refreesh I saw that the Prameter values just dissappeared.

提前谢谢我的任何帮助得到。

Thankx in advance for any help I can get.

推荐答案

我已在以下帖子中给你的帖子发表评论

<标题="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1966424&SiteID=1"href ="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1966424& ; SiteID = 1"> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1966424&SiteID=1

希望有所帮助


这篇关于Cystal与VS2005和SQL 2005 ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆