为什么SetDataSource这么慢? [英] Why is SetDataSource so slow?

查看:339
本文介绍了为什么SetDataSource这么慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


您好,



我正在使用CrystalReportViewer在Visual Studio 2005上进行开发,以便从我们的应用程序中显示Windows窗体中的Crystal Report。我遇到的问题是ReportDocument-> SetDataSource(数据集)方法耗费了很长时间,从而影响了我们的应用程序的性能。我的问题是为什么会这样?以下是处理表单显示的代码示例。



DataSet ^ ds = gcnew DataSet();


String ^ ConnStr = " SELECT *" +


" FROM DailyCalAud LEFT OUTER JOIN DailyCalTest" +


" ON DailyCalAud.Id = DailyCalTest.DCAudId" +


" ORDER BY DailyCalAud.SerNum,DailyCalAud.Model,TestDate,TestTime" ;


SqlConnection ^ conn = gcnew SqlConnection( "数据源= PC \\BMIMSDESERVER;初始值Catalog = stx52013; Integrated Security = TRUE" );


SqlCommand ^ command = gcnew SqlCommand(ConnStr ,conn);


SqlDataAdapter ^ adapt = gcnew SqlDataAdapter(command);


conn-> Open();


adapt-> ;填充(ds);


conn->关闭();


reportDocument2-> SetDataSource(ds) ; ******此行导致持有*******


SetDBLogonForReport(connectionInfo,ds);


reportDocument2- > SetDatabaseLogon( " user" ," password " " PC\\BMIMSDESERVER" " stx52013" );


crystalReportViewer1-> ReportSource = Form2 :: reportDocument2;



我做了很多搜索,但没有找到这个特定问题的任何答案。我必须使用推送方法将数据集推送到报表,因为我的SQL需要在运行时更改,所以如果你有任何解决方案,请记住这一点。



解决方案

@Wooger ...我知道这是前一段时间,但你有没有找到解决方案呢?谢谢!

 

Hello,

 

I'm developing on Visual Studio 2005 using a CrystalReportViewer to display a Crystal Report in a Windows Form from our application.  The problem I'm having is that the ReportDocument->SetDataSource(dataset) method is taking a painfully long time and thus affecting the performance of our application.  My question is why is this?  Here is the sample of my code that handles the displaying of the form.

 

DataSet^ ds = gcnew DataSet();

String ^ConnStr = "SELECT * " +

"FROM DailyCalAud LEFT OUTER JOIN DailyCalTest " +

"ON DailyCalAud.Id = DailyCalTest.DCAudId " +

"ORDER BY DailyCalAud.SerNum, DailyCalAud.Model, TestDate, TestTime";

SqlConnection^ conn = gcnew SqlConnection("Data Source=PC\\BMIMSDESERVER; Initial Catalog=stx52013;Integrated Security = TRUE");

SqlCommand^ command = gcnew SqlCommand(ConnStr, conn);

SqlDataAdapter^ adapt = gcnew SqlDataAdapter(command);

conn->Open();

adapt->Fill(ds);

conn->Close();

reportDocument2->SetDataSource(ds); ****** This line is causing the holdup *******

SetDBLogonForReport(connectionInfo, ds);

reportDocument2->SetDatabaseLogon("user", "password", "PC\\BMIMSDESERVER","stx52013");

crystalReportViewer1->ReportSource = Form2::reportDocument2;

 

I have done a lot of searching but haven't found any answers to this particular problem.  I have to use the push method of pushing a dataset to the report because my SQL needs to be changed at runtime so if you have any solutions keep that in mind.

 

 

解决方案

@Wooger... I know this was a while ago, but did you ever find a resolution for this?  Thanks!


这篇关于为什么SetDataSource这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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