类型或命名空间名称“Crystals Reports”在命名空间“CrystalDecision”中不存在 [英] The type or namespace name "Crystals Reports" doesn't exist in namespace "CrystalDecision"

查看:112
本文介绍了类型或命名空间名称“Crystals Reports”在命名空间“CrystalDecision”中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使我添加名称

Even I add namespace like

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.IO;
using System.Web.UI.WebControls;





并添加参考

crystaldecision.crystalreport.engine

crystaldecision.shared



我有一个错误如





and also add reference
crystaldecision.crystalreport.engine
crystaldecision.shared

I got an error like

Error	2	The type or namespace name 'CrystalReports' does not exist in the namespace 'CrystalDecisions' (are you missing an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	10	24	FB_BILLING
Error	3	The type or namespace name 'Shared' does not exist in the namespace 'CrystalDecisions' (are you missing an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	11	24	FB_BILLING
Error	4	The type or namespace name 'ReportDocument' could not be found (are you missing a using directive or an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	24	9	FB_BILLING
Error	5	The type or namespace name 'Tables' could not be found (are you missing a using directive or an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	25	9	FB_BILLING
Error	6	The type or namespace name 'TableLogOnInfos' could not be found (are you missing a using directive or an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	27	9	FB_BILLING
Error	7	The type or namespace name 'TableLogOnInfo' could not be found (are you missing a using directive or an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	28	9	FB_BILLING
Error	8	The type or namespace name 'ConnectionInfo' could not be found (are you missing a using directive or an assembly reference?)	E:\New folder\Vinay\FB_BILLING\FBB_Reports.cs	29	9	FB_BILLING





我的源代码如下





My source code like these

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.IO;
using System.Web.UI.WebControls;

namespace FB_BILLING
{
    public partial class FBB_Reports : Form
    {

        public static int m_Ids;
        public static string m_Paths;
        public static DataTable m_dt = null;

        ReportDocument cryRpt = new ReportDocument();
        Tables crTables;
        Table crTable;
        TableLogOnInfos crTableLogonInfos;
        TableLogOnInfo crTableLogOnInfo;
        ConnectionInfo crConnectionInfo = new ConnectionInfo();

        public FBB_Reports(int i_Ids, string s_Paths, DataTable dt)
        {
            InitializeComponent();
            m_Ids = i_Ids;
            m_Paths = s_Paths;
            m_dt = dt;

        }

        private void InitializeComponent()
        {
            throw new NotImplementedException();
        }

        private void FBB_Reports_Load(object sender, EventArgs e)
        {
            string sPath = Application.StartupPath;
            Directory.SetCurrentDirectory(sPath);
            if (m_Paths == "Reports/Quotation.rpt")
            {
                PrepareQuatation();
            }
            if (m_Paths == "Reports/InvoiceTotal.rpt")
            {
                PrepareData();

            }
            if (m_Paths == "Reports/InvoiceBill.rpt")
            {
                PrepareInvoice();
            }

            if (m_Paths == "Reports/QuotationBill.rpt")
            {
                PrepareQuotation();
            }
            this.WindowState = FormWindowState.Maximized;
            FBB_Progress objProgress = new FBB_Progress();
            objProgress.Hide();
        }
        private void PrepareInvoice()
        {
            Table crTable;
            Tables crTables;
            string sPath = Application.StartupPath;
            Directory.SetCurrentDirectory(sPath);


            cryRpt.Load(m_Paths);
            crTables = cryRpt.Database.Tables;


            CDBConnectionInfo crDBConnectionInfo = CUtil.GetConnection();
            TableLogOnInfo LogOnInfo = new TableLogOnInfo();
            crConnectionInfo.ServerName = crDBConnectionInfo.ServerName;
            crConnectionInfo.DatabaseName = "FB_Billing";
            crConnectionInfo.UserID = crDBConnectionInfo.UserName;
            crConnectionInfo.Password = crDBConnectionInfo.Password;
            crConnectionInfo.IntegratedSecurity = crDBConnectionInfo.IntegratedAuth;
            foreach (Table crTable_loopVariable in crTables)
            {
                crTable = crTable_loopVariable;
                crTableLogOnInfo = crTable.LogOnInfo;
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogOnInfo);
            }

            cryRpt.SetParameterValue("@INVOICE_MASTER_ID", m_Ids);
            xcrvReports.ReportSource = cryRpt;
        }
        private void PrepareQuotation()
        {
            Table crTable;
            Tables crTables;
            string sPath = Application.StartupPath;
            Directory.SetCurrentDirectory(sPath);


            cryRpt.Load(m_Paths);
            crTables = cryRpt.Database.Tables;


            CDBConnectionInfo crDBConnectionInfo = CUtil.GetConnection();
            TableLogOnInfo LogOnInfo = new TableLogOnInfo();
            crConnectionInfo.ServerName = crDBConnectionInfo.ServerName;
            crConnectionInfo.DatabaseName = "FB_Billing";
            crConnectionInfo.UserID = crDBConnectionInfo.UserName;
            crConnectionInfo.Password = crDBConnectionInfo.Password;
            crConnectionInfo.IntegratedSecurity = crDBConnectionInfo.IntegratedAuth;
            foreach (Table crTable_loopVariable in crTables)
            {
                crTable = crTable_loopVariable;
                crTableLogOnInfo = crTable.LogOnInfo;
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogOnInfo);
            }

            cryRpt.SetParameterValue("@QUOTATION_MASTER_ID", m_Ids);
            xcrvReports.ReportSource = cryRpt;
        }
        private void PrepareData()
        {
            cryRpt.Load(m_Paths);
            crTables = cryRpt.Database.Tables;
            FBB_InvoiceManage objInvoiceMng = new FBB_InvoiceManage(true);
            DataGridView xdvgInvoice = objInvoiceMng.xdgvInvoiceManage;
            for (int ix = 0; ix <= xdvgInvoice.Rows.Count - 1; ix++)
            {
                DataRow dr = m_dt.NewRow();
                dr["INVOICEMASTERID"] = "";
                dr["CUSTOMER_NAME"] = "";
                dr["INVOICE_NUMBER"] = "";
                dr["ISSUES_DATE"] = "";
                dr["TOTAL_AMOUNT"] = "";
                dr["AMOUNT_OWING"] = "";

            }

            ///
            CDBConnectionInfo crDBConnection = CUtil.GetConnection();

            TableLogOnInfo LogInfo = new TableLogOnInfo();
            crConnectionInfo.ServerName = crDBConnection.ServerName;
            crConnectionInfo.DatabaseName = "FB_Billing";
            crConnectionInfo.UserID = crDBConnection.UserName;
            crConnectionInfo.Password = crDBConnection.Password;
            crConnectionInfo.IntegratedSecurity = crDBConnection.IntegratedAuth;
            //crTables = cryRpt.Database.Tables;

            foreach (Table crTable_loopVariable in crTables)
            {
                crTable = crTable_loopVariable;
                crTableLogOnInfo = crTable.LogOnInfo;
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogOnInfo);
            }


            cryRpt.SetDataSource(m_dt);
            xcrvReports.ReportSource = cryRpt;
            this.Text = "Invoice Report";
        }
        private void PrepareQuatation()
        {
            cryRpt.Load(m_Paths);
            crTables = cryRpt.Database.Tables;

            FBB_QuatationManage objQuotationMng = new FBB_QuatationManage(true);
            DataGridView xdgvQuotation = objQuotationMng.xdgvQuatationManage;

            for (int ix = 0; ix <= xdgvQuotation.Rows.Count - 1; ix++)
            {
                DataRow dr = m_dt.NewRow();
                dr["QUOTATION_NUMBER"] = "";
                dr["CUSTOMER_NAME"] = "";
                dr["QUOTATION_DATE"] = "";
                dr["TOTAL_AMOUNT"] = "";
            }

            CDBConnectionInfo crDBConnectionInfo = CUtil.GetConnection();
            TableLogOnInfo LogOnInfo = new TableLogOnInfo();
            crConnectionInfo.ServerName = crDBConnectionInfo.ServerName;
            crConnectionInfo.DatabaseName = "FB_Billing";
            crConnectionInfo.UserID = crDBConnectionInfo.UserName;
            crConnectionInfo.Password = crDBConnectionInfo.Password;
            crConnectionInfo.IntegratedSecurity = crDBConnectionInfo.IntegratedAuth;
            foreach (Table crTable_loopVariable in crTables)
            {
                crTable = crTable_loopVariable;
                crTableLogOnInfo = crTable.LogOnInfo;
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogOnInfo);
            }
            cryRpt.SetDataSource(m_dt);
            xcrvReports.ReportSource = cryRpt;
            this.Text = "Quotation Report";

        }
    }

}





代码块添加 - OriginalGriff [/ edit]



[edit]Code block added - OriginalGriff[/edit]

推荐答案

取出两行:

Take out the two lines:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;



然后编译你的程序 - 你会收到错误。 />
转到第一个错误 - 可能在线:


Then compile your program - you will get errors.
GO to the first error - probably on the line:

ReportDocument cryRpt = new ReportDocument();

并将光标放在第一个带有红色下划线的单词中。一个小蓝框将出现在单词的开头。将鼠标悬停在框上,会出现一个下拉列表。打开下拉列表,它将有可能解决问题的方法。第一个应该是使用...选择它,它会为你添加using语句。重复此操作,直到您的引用正确为止。

and put the cursor in the first word that is underlined in red. A small blue box will appear at the beginning of the word. Hover the mouse over the box, and a dropdown will appear. Open the drop down, and it will have possible solutions to the problem. The first one should be "using ..." select it and it will add the using statement for you. Repeat this until your references are correct.


在visual studio中,转到项目图标 - > properties->将目标框架工作更改为.net框架4.之后在解决方案资源管理器中 - >添加引用,你可以看到所有的晶体报告dll并添加它。
In visual studio go to project icon on top->properties->change target frame work to .net framework 4. after that in solution explorer-> add reference ,you can see all the crystal report dll and add it.


这篇关于类型或命名空间名称“Crystals Reports”在命名空间“CrystalDecision”中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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