水晶报表未检索任何数据 [英] crystal report didn't retrive any data

查看:78
本文介绍了水晶报表未检索任何数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 SqlConnection con =  SqlConnection(" 数据源=服务器;初始目录= f_library;用户ID = sa;密码= ahmed");
con.Open();
DataSet dataReport =  DataSet();
SqlDataAdapter myDataAdapter =  SqlDataAdapter();
myDataAdapter.Fill(dataReport," );
myDataReport myDataReport =  myDataReport();
myDataReport.SetDataSource(dataReport);
crystalReportViewer1.ReportSource = myDataReport;




我使用此代码将crystalreport数据检索到crystalreportviewer
我有这个错误

类型或名称空间名称"myDataReport"

[edit]已添加代码块,将我的内容作为纯文本..."选项已禁用-OriginalGriff [/edit]

解决方案

您需要查看您的位置声明了"myDataReport"类-您是否完全按照这样拼写?请记住,C#区分大小写,并且大多数类都以大写字母开头.

如果可以,请检查它是否与代码位于相同的名称空间中;如果不是,则可能需要包含using语句或完全限定类名才能访问它.

如果一切正常,请检查它是否不在其他项目或DLL文件中-如果正确,则可能需要添加对项目或DLL的引用才能使用它.


SqlConnection con = new SqlConnection("Data Source=server;Initial Catalog=f_library;User ID=sa;Password=ahmed");
con.Open();
DataSet dataReport = new DataSet();
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
myDataAdapter.Fill(dataReport, "emp");
myDataReport myDataReport = new myDataReport();
myDataReport.SetDataSource(dataReport);
crystalReportViewer1.ReportSource = myDataReport;




i used this code to retrive crystalreport data to crystalreportviewer
i have this error

The type or namespace name ''myDataReport''

[edit]Code block added, "Treat my content as plain text..." option disabled - OriginalGriff[/edit]

解决方案

You need to look at where you declared the class "myDataReport" - did you spell it exactly like that? Remember that C# is case sensitive, and most classes start with an upper case letter.

If that is fine, check it is in the same namespace as your code, if it isn''t, you may need to include a using statement or fully qualify the class name in order to access it.

If all that is fine, then check it is not in a different project, or DLL file - if it is, you may need to add a reference to the project or DLL to use it.


这篇关于水晶报表未检索任何数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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