如何将水晶报告11附加到VS 2012? [英] how to attach crystal report 11 to VS 2012?

查看:53
本文介绍了如何将水晶报告11附加到VS 2012?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我是VS2012的新手。我正在使用CR-11进行报道。我已完成所有编码部分以附加VS的报告。我之前和VS2010一起工作过,它运行得很好。但是在VS2012中它显示了晶体决策的错误。我想尽早解决这个问题。他们的任何错误或其他什么?错误是



错误3找不到类型或命名空间名称''CrystalDecisions''(您是否缺少using指令或程序集引用?)D:\\ \\Live Project \Weighing Machine \ WeighingBridgeMachine \ frmReport.cs 22 26 WeighingBridgeMachine





我的代码是





hello,

I am new in VS2012. I am using CR-11 for report. I have done all coding part to attach report with VS. I have worked before with VS2010, it work well with that. But in VS2012 it shows the error of crystal decision.I want to solve this problem as early as possible. Is their any referal error or something else?? Error is

Error 3 The type or namespace name ''CrystalDecisions'' could not be found (are you missing a using directive or an assembly reference?) D:\Live Project\Weighing Machine\WeighingBridgeMachine\frmReport.cs 22 26 WeighingBridgeMachine


And my code is


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeighingBridge.Data;
using WeighingBridge.DataAccess;

namespace WeighingBridgeMachine
{
    public partial class frmReport : Form
    {
        public frmReport()
        {
            InitializeComponent();
        }

        //public frmReport(CrystalDecisions.CrystalReports.Engine.ReportDocument rDocument)
        //{
        //    rDoc = rDocument;
        //    frmReportProgress _frmReportProgress = new frmReportProgress();
        //    _frmReportProgress.Show();
        //    InitializeComponent();
        //    try
        //    {


        //        string[] strCredential = System.Configuration.ConfigurationSettings.AppSettings.Get("CrystalReport").Split(';');
        //        rDoc.SetDatabaseLogon(strCredential[2], strCredential[3], strCredential[0], strCredential[1]);
        //        CrystalDecisions.Shared.ConnectionInfo con = new CrystalDecisions.Shared.ConnectionInfo();
        //        con.DatabaseName = strCredential[1];
        //        con.ServerName = strCredential[0];
        //        con.UserID = strCredential[2];
        //        con.Password = strCredential[3];

        //        CrystalDecisions.Shared.TableLogOnInfo conTable = new CrystalDecisions.Shared.TableLogOnInfo();
        //        conTable.ConnectionInfo = con;
        //        foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in rDoc.Database.Tables)
        //        {

        //            crTable.ApplyLogOnInfo(conTable);
        //        }

        //        IsNoRecord = true;
        //        if (rDoc.Rows.Count > 0)
        //        {
        //            crystalReportViewer1.ReportSource = rDoc;

        //        }
        //        else
        //        {
        //            MessageBox.Show("No Record");
        //            IsNoRecord = false;
        //        }
        //        //crystalReportViewer2.RefreshReport();
        //        _frmReportProgress.Dispose();
        //    }
        //    catch (Exception ex) { MessageBox.Show(ex.Message); }
        //}

        //public frmReport(string rptPath, string rptRecordFormula)
        //{

        //    CrystalDecisions.CrystalReports.Engine.ReportDocument rDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        //    rDocument.Load(Application.StartupPath + "\\Reports\\" + rptPath);
        //    rDocument.RecordSelectionFormula = rptRecordFormula;
        //    rDoc = rDocument;

        //    frmReportProgress _frmReportProgress = new frmReportProgress();
        //    _frmReportProgress.Show();
        //    InitializeComponent();
        //    try
        //    {
        //        string[] strCredential = System.Configuration.ConfigurationSettings.AppSettings.Get("CrystalReport").Split(';');
        //        rDoc.SetDatabaseLogon(strCredential[2], strCredential[3], strCredential[0], strCredential[1]);
        //        CrystalDecisions.Shared.ConnectionInfo con = new CrystalDecisions.Shared.ConnectionInfo();
        //        con.DatabaseName = strCredential[1];
        //        con.ServerName = strCredential[0];
        //        con.UserID = strCredential[2];
        //        con.Password = strCredential[3];

        //        CrystalDecisions.Shared.TableLogOnInfo conTable = new CrystalDecisions.Shared.TableLogOnInfo();
        //        conTable.ConnectionInfo = con;
        //        foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in rDoc.Database.Tables)
        //        {

        //            crTable.ApplyLogOnInfo(conTable);
        //        }

        //        IsNoRecord = true;
        //        if (rDoc.Rows.Count > 0)
        //        {
        //            crystalReportViewer1.ReportSource = rDoc;

        //        }
        //        else
        //        {
        //            MessageBox.Show("No Record");
        //            IsNoRecord = false;
        //        }
        //        crystalReportViewer1.RefreshReport();
        //        _frmReportProgress.Dispose();
        //    }
        //    catch (Exception ex) { MessageBox.Show(ex.Message); _frmReportProgress.Dispose(); }
        //}

        //private void frmReport_Load(object sender, EventArgs e)
        //{
        //    this.Location = new Point(100, 40);
        //    if (!IsNoRecord)
        //        this.Close();
        //    this.WindowState = FormWindowState.Maximized;
        //}

        //public bool IsNoRecord
        //{
        //    get;
        //    set;
        //}

        //public CrystalDecisions.CrystalReports.Engine.ReportDocument rDoc
        //{
        //    get;
        //    set;
        //}




        //private void a4ToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    GenrateReport(CrystalDecisions.Shared.PaperSize.PaperA4);
        //}

        //private void GenrateReport(CrystalDecisions.Shared.PaperSize paperSize)
        //{
        //    frmReportProgress _frmReportProgress = new frmReportProgress();
        //    _frmReportProgress.Show();

        //    try
        //    {
        //        rDoc.PrintOptions.PaperSize = paperSize;
        //        string[] strCredential = System.Configuration.ConfigurationSettings.AppSettings.Get("CrystalReport").Split(';');
        //        rDoc.SetDatabaseLogon(strCredential[2], strCredential[3], strCredential[0], strCredential[1]);
        //        CrystalDecisions.Shared.ConnectionInfo con = new CrystalDecisions.Shared.ConnectionInfo();
        //        con.DatabaseName = strCredential[1];
        //        con.ServerName = strCredential[0];
        //        con.UserID = strCredential[2];
        //        con.Password = strCredential[3];

        //        CrystalDecisions.Shared.TableLogOnInfo conTable = new CrystalDecisions.Shared.TableLogOnInfo();
        //        conTable.ConnectionInfo = con;
        //        foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in rDoc.Database.Tables)
        //        {

        //            crTable.ApplyLogOnInfo(conTable);
        //        }

        //        IsNoRecord = true;
        //        if (rDoc.Rows.Count > 0)
        //        {
        //            crystalReportViewer1.ReportSource = rDoc;

        //        }
        //        else
        //        {
        //            MessageBox.Show("No Record");
        //            IsNoRecord = false;
        //        }
        //        //crystalReportViewer2.RefreshReport();
        //        _frmReportProgress.Dispose();
        //    }
        //    catch (Exception ex) { MessageBox.Show(ex.Message); }
        //}

        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {

        }

        private void frmReport_Load(object sender, EventArgs e)
        {

        }
    }
}

推荐答案

找不到类型或命名空间名称''CrystalDecisions''(您是否缺少using指令或程序集引用) ?)

缺少对水晶组件的参考。确保系统中存在所需的版本,并在项目中引用该版本。
The type or namespace name ''CrystalDecisions'' could not be found (are you missing a using directive or an assembly reference?)
Reference to crystal assembly is missing. Make sure that the needed version is present on the system and you refer that in your project.


这篇关于如何将水晶报告11附加到VS 2012?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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