C#在form里创建水晶报表教程,”加载报表失败,can't resolve strongly report at design time“

水晶报表在每次调试的时候,打开它用crystalreportview看时候都会跳出&数据库登录窗口&,有没有办法不让它显示,直接打开。
[问题点数:100分,结帖人vbhh]
水晶报表在每次调试的时候,打开它用crystalreportview看时候都会跳出&数据库登录窗口&,有没有办法不让它显示,直接打开。
[问题点数:100分,结帖人vbhh]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
本帖子已过去太久远了,不再提供回复功能。1191人阅读
1 操作:点击打印按钮(打印GridView列表中的记录)
2 错误信息:
================================================================================================ & &/&应用程序中的服务器错误。 -------------------------------------------------------------------------------- 打开报表失败。& 说明:&执行当前&Web&请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。& 异常详细信息:&System.Exception:打开报表失败。 源错误:& 执行当前&Web&请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。&& 堆栈跟踪:& [COMException&(0x):&打开报表失败。] &&&CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&&DocumentPath,&Int32&Options)&+0 &&&CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open&(Object&&DocumentPath,&Int32&Options)&+77 &&&CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()&+218 [Exception:&加载报表失败。] &&&CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()&+273 &&&CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String&filename,&OpenReportMethod&openMethod,&Int16&parentJob)&+875& &&&CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String&filename)&+52 &&&Report.Web.Report_Ord_Tihuodan.Page_Load(Object&sender,&EventArgs&e)&in&f:/application/web/erpreport/web/report_ord_tihuodan.aspx.cs:89& &&&System.Web.UI.Control.OnLoad(EventArgs&e)&+67 &&&System.Web.UI.Control.LoadRecursive()&+35 &&&System.Web.UI.Page.ProcessRequestMain()&+750 ==========================================================================================================
3 解决过程
3.1&修改注册表
HKEY_LOCAL_MACHINE-&SOFTWARE-&Crystal Decisions-&10.2-&Report ApplicationServer-&Server&PrintJobLimit为-1或300,1000,测试次数最多可延长至148次
重启IIS,测试网站,点击次数为235左右时又出错了(PrintJobLimit设置为-1,0,300,500结果一样)
3.2 系统TEMP目录赋予users操作的权限
3.3 使用BAT文件定时重启IIS
清空C:/Documents and Settings/username/ASPNET/Local Settings/Temp/ 下tmp文件
不是长久之计。
3.4& 关闭和释放报表资源
private&void&Page_Unload(object&sender,&EventArgs&e) { ReportDoc.Close(); ReportDoc.Dispose(); }
First, the problem is the AppPool, if you review the task manager you can see&w3wp.exe with a high Mem Usage this is because you run many reports at the same time and keep alive for many time, this issue produce the error, because don't have more memory assigned to run more reports, the limit&are 75. Review your settings in IIS Manager, indetify you application pool, in the Performace Options set &Shutdown worker proccess...& to 5 or something similar&and &Limit the kernel request queue..& to 4000 or something similar. Open the report and see if w3wp.exe close or reduce Mem Usage in the time where you set.
应急措施:重启IIS
永久措施:关闭和释放报表资源
5 参考文章
5.1 &The maximum report processing jobs limit configured by your system administrator has been reached.&
5.2 Use the Close() Method to free up the report
5.3 开启报表出错
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:24931次
排名:千里之外
原创:11篇
转载:19篇
(1)(1)(2)(1)(3)(1)(2)(1)(1)(1)(1)(1)(2)(2)(2)(5)(3)在我们开发各种工具软件的时候,我们不可避免的会遇到打印的问题。而使用.NET开发打印功能,水晶报表或许会是一个十分不象错的选择! 一般步骤:
准备好想要打印的数据源; 制作用于规定打印结果样式的模板文件(.rpt); 创建用于打印的执行窗口Form1,并在其中放置一个CrystalReportViewer& (第三方控件,来自SAP) 创建打印按键所在的Form2; 获取系统所能使用的打印机; 设置使用的打印机,及打印相关参数; 使用Form2调用Form1完成打印。 & 水晶报表的一般概念 水晶报表的两种模式:
拉 PULL:设置好数据连接之后,使用水晶报表文件中所使用的获得数据的方式,由水晶报表自己解决数据获取操作。
推 PUSH:使用DataSet装载数据,然后填充到水晶报表中,再按照水晶报表的格式来展示。
& 相关控件:
CrystalReportViewer&&& 「数据展示者」「ASP.NET & WinForm」
CrystalReportSource&& 「数据提供者」「ASP.NET」
CrystalReport&&&&&&&&&&&&&&& 「数据提供者」「WinForm」
& 命名空间:
CrystalDecisions.Shared
CrystalDecisions.CrystalReports.Engine
& 相关成员:
类名 成员名 描述
CrystalReport
Load 加载水晶报表(.rpt)文件
& SetDatabaseLogon 设置数据库连接,PULL中会用到
& SetParameterValue 设置报表值
CrystalReportViewer ReportSource 设置报表数据源
& DataBind 绑定数据源
CrystalReportSource ReportDocument.Load 加载水晶报表(.rpt)文件,Server.MapPath("*********.rpt")
& ReportDocument.SetDatabaseLogon 设置数据库连接,PULL中会用到
& ReportDocument.SetParameterValue 设置报表值
& & & & 具体实现 打印模板文件样式
Form2using System.W
// 引入可以访问 app.config 中的项
using System.Drawing.P
// 打印必须
namespace csdemo.reportdemo
/// &summary&
/// MainWindow.xaml 的交互逻辑
/// &/summary&
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
/// &summary&
/// 获取可用打印机
/// &/summary&
/// &param name="sender"&&/param&
/// &param name="e"&&/param&
private void button1_Click(object sender, RoutedEventArgs e)
comboBox1.Items.Clear();
foreach (var item in PrinterSettings.InstalledPrinters)
comboBox1.Items.Add(item.ToString());
comboBox1.SelectedIndex = 0;
/// &summary&
/// 打印机名称
/// &/summary&
private string _printerName=string.E
/// &summary&
/// 设置打印机
/// &/summary&
/// &param name="sender"&&/param&
/// &param name="e"&&/param&
private void button2_Click(object sender, RoutedEventArgs e)
_printerName = comboBox1.SelectedValue.ToString();
/// &summary&
/// 调用打印
/// &/summary&
/// &param name="sender"&&/param&
/// &param name="e"&&/param&
private void button3_Click(object sender, RoutedEventArgs e)
PrintWindow pw = new PrintWindow();
pw.printerName = _printerN
pw.Show();
pw.Close();
Form1using System.W
using System.Data.SqlC
using CrystalDecisions.CrystalReports.E
namespace csdemo.reportdemo
/// &summary&
/// PrintWindow.xaml 的交互逻辑
/// &/summary&
public partial class PrintWindow : Window
public PrintWindow()
InitializeComponent();
Data_Binding();
public string printerName = string.E
private void Data_Binding()
System.Data.DataSet ds = new System.Data.DataSet();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = @"Data Source=192.168.0.196;Initial Catalog=NewEMaxTPersist Security Info=TUser ID=Password=qwerta";
conn.Open();
string cmd = "select * from TBusRetail";
SqlDataAdapter da = new SqlDataAdapter(cmd, conn);
da.Fill(ds, "TBusRetail");
conn.Close();
string pathRpt = @"D:\Projects\csdemo\branches\csdemo2010\csdemo.reportdemo\ReportFile\DemoCrystalReport.rpt";
// ****************************************************
ReportDocument repostDoc = new ReportDocument();
repostDoc.Load(pathRpt);
// 加载打印模板文件
repostDoc.SetDataSource(ds);
// 设置数据源
repostDoc.PrintOptions.PrinterName = printerN
// 设置打印机名称
repostDoc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;
// 设置打印纸张样式
repostDoc.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperO
repostDoc.PrintToPrinter(1, false, 1, 1);
// 只打印一页,不核对,从第 0 页打印到第0页
// ****************************************************
// 如果要显示数据的话,就可以使用这个来在Viwer中绑定数据源了。
// crv.ViewerCore.ReportSource = repostD
在使用VS2010配合水晶报表时,需要更改工程的目标框架为「.NET Framework 4」不然会出现错误。
我在使用的时候,不知道是不是我个人机器的原因,一真会提示有一个文件在「dotnet1」下找不到,之后我到它的上级目录拷贝了相关的文件过去就好了~
参考网摘:
阅读(...) 评论()求高手:水晶报表发布后提示“无效文件名,加载报表失败”
[问题点数:70分]
求高手:水晶报表发布后提示“无效文件名,加载报表失败”
[问题点数:70分]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
2011年12月 .NET技术大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。C# WinForm中水晶报表配置好了,用crystalReportViewer显示怎么只有字段名,没有看到数据_百度知道
C# WinForm中水晶报表配置好了,用crystalReportViewer显示怎么只有字段名,没有看到数据
SQL语句没有问题,表里也有数据 ,运行没提示错误,那位大哥帮我看下,不知道哪里出了问题我写了个数据库的连接类(补充的字有限,还有个关闭和打开的连接没列出)class Db
private SqlC
private static string sconn = @&连接SQL的字符串&;
public DataSet GetDataset(string sql) //返回数据集
this.Open();
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
this.Close();
}在窗体的加载事件如下: private void Form1_Load(object sender, EventArgs e)//窗体加载
CrystalReport1 rpMember = new CrystalReport1();
DataSet dszy = new Db().GetDataset(&SQL语句&);
rpMember.SetDataSource(dszy);
crystalReportViewer1.ReportSource = rpM
提问者采纳
你没填充数据怎么会有数据,你在数据集里拖出来的
表只是一个表结构
DataSet1 ds = new DataSet1();
using (SqlConnection conn = new SqlConnection(conString))
using (SqlDataAdapter adpt = new SqlDataAdapter(&select * from MedicionType&, conn))
adpt.Fill(ds, &表名,必须和你的数据集里拖出来的一样&);
CrystalReport1 cys = new CrystalReport1();
cys.SetDataSource(ds);
this.crystalReportViewer1.ReportSource =
提问者评价
谢谢!原来是没有写表名
其他类似问题
为您推荐:
其他2条回答
你选的报表数据源是什么,是直接的数据库表的话,可能是数据没有放到详细信息里面,如果选的是项目数据源,那就一定要先FILL数据进去
检查你的SQL语句,如果没问题,就打开数据库,看看里面表里是否有数据存在。
您可能关注的推广
crystalreportviewer的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 水晶报表教程 的文章

 

随机推荐