如何从错误中退出:找不到类型或名称空间名称"CrystalReport1" [英] how to getout from the error : The type or namespace name 'CrystalReport1' could not be found

查看:65
本文介绍了如何从错误中退出:找不到类型或名称空间名称"CrystalReport1"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai all
我正在使用asp.net4.0和c#4.0建立网站,后端是Sql server2008.
当iam尝试执行以下代码时,将生成以下错误.
代码:

hai all
i am building a website using asp.net4.0 and c#4.0,backend is Sql server2008.
when iam trying to execute the following code an error below is generated.
Code:

protected void bt_rep0_Click(object sender, EventArgs e)
    {
        string sql;
        sql = "SELECT m.[proj_ID] ,pt.[proj_type_ff],m.[proj_no],m.[proj_prop_no],m.[Proj_title],pr.[investigator_name], pa.[investigator_name],fa.[fund_agency_acronym],m.[Budg],m.[from_date],m.[close_date],pe.[ext_date],m.[RptNo],m.[status] FROM [monitor].[dbo] .[MENU] m LEFT OUTER JOIN [monitor].[dbo].[pro_investigator] pr ON m.[investgator_id] = pr.[investgator_id] LEFT OUTER JOIN [monitor].[dbo] .[project_type] pt ON m.[proj_type_id]  = pt.[proj_type_id] LEFT OUTER JOIN [monitor] .[dbo] .[project_AItable] pa on m.[proj_ID] = pa.[proj_ID] LEFT OUTER JOIN [monitor].[dbo].[project_FAtable] pf on m.[proj_ID] = pf.[proj_ID] LEFT OUTER JOIN [monitor] .[dbo] .[fund_agency] fa on pf.[fund_agency_id] = fa.[fund_agency_id] LEFT OUTER JOIN [monitor] .[dbo] .[project_ext] pe on m.[proj_ID] = pe.[proj_ID] order by m.[proj_ID] ";

        c27.cmd = new System.Data.SqlClient.SqlCommand(sql, c27.connect());
        c27.da = new System.Data.SqlClient.SqlDataAdapter(sql, c27.connect());
        c27.da.Fill(c27.ds);
        c27.da.Fill(c27.ds, "ss");
        //MessageBox.Show(c27.ds.Tables[1].Rows.Count.ToString());


       //crystalr
        CrystalReport1 objRpt = new CrystalReport1();//error generating code
        objRpt.SetDataSource(c27.ds.Tables[1]);
        CrystalReportViewer1.ReportSource = objRpt;

        ////////////CrystalReportViewer1;
        ////////////crystalReportViewer1.Refresh();
    }



错误声明:



Error Statement :

Error 48 The type or namespace name ''CrystalReport1'' could not be found (are you missing a using directive or an assembly reference?)



有什么可以帮助我摆脱这个错误



can any help me to get out from this error
thanks in advance.

推荐答案

看这里:类似的问题已解决 [ ^ ]

基于此,较早的版本不允许这样做.如果您使用的是VS2010,请尝试:
1.转到项目的属性
2.选择Target Framework作为.NET Framework 4(平台Target为x86或x64)
Look here: Similar issue resolved[^]

Based on it, earlier versions did not allow this. In case you are on VS2010, try:
1. Go to Properties of the project
2. Choose Target Framework as .NET Framework 4 (Platform Target as x86 or x64)


尝试将所有Crystal Reports引用添加到项目的引用文件夹中.另外,将对类的引用添加到您的类中,例如
"
try adding all the references of crystal report to the reference folder on your project. Also add the references to your class like
"
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;


"


添加了水晶报表所需的引用
added reference that is needed for crystal reports


这篇关于如何从错误中退出:找不到类型或名称空间名称"CrystalReport1"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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