this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();错误:“CrystalDecisions.ReportSource.ReportSourceFactory”的类型初始值设定项引发异常。

解决方案 »

  1.   

    导入这两句
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared; this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();前缀都去掉 直接new试试
      

  2.   

    前缀都去掉 直接new试试你指的前缀是哪个?
      

  3.   


    private void InitializeComponent()
            {
                this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                this.CrystalReport11 = new WindowsFormsApplication1.CrystalReport1();
                this.SuspendLayout();
                // 
                // crystalReportViewer1
                // 
                this.crystalReportViewer1.ActiveViewIndex = 0;
                this.crystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                this.crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.crystalReportViewer1.Location = new System.Drawing.Point(0, 0);
                this.crystalReportViewer1.Name = "crystalReportViewer1";
                this.crystalReportViewer1.ReportSource = this.CrystalReport11;
                this.crystalReportViewer1.Size = new System.Drawing.Size(702, 542);
                this.crystalReportViewer1.TabIndex = 0;
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(702, 542);
                this.Controls.Add(this.crystalReportViewer1);
                this.Name = "Form1";
                this.Text = "Form1";
                this.ResumeLayout(false);        }
      

  4.   

    web.config
     <configSections>
       <!-- 要加载的配置文件 -->
        <section name="SysInit" type="System.Configuration.NameValueSectionHandler" />
      </configSections> 
      

  5.   

    我加上了,么用啊!!在appconfig文件里面<?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <appSettings>
        <add key="InPort" value="5"/>
        <add key="OutPort" value="6"/>
        <add key="InBaudRate" value="57600"/>
        <add key="OutBaudRate" value="57600"/>
        <add key="AutoOpenComm" value="1"/>
        <add key="AlarmName" value="alarm.wav"/>
        <add key="InStoreName" value="InStore.wav"/>
        <add key="OutStoreName" value="OutStore.wav"/>
        <add key="AutoMemory" value="1"/>
        <add key="UserName" value="admin"/>
        <add key="Password" value=""/>
        <add key="Port" value="2654"/>
        <add key="IP" value="127.0.0.1"/>
      </appSettings>
      <connectionStrings>
        <add name="CONN" connectionString="data source=192.168.0.100;initial catalog=SimCarSys;user=sa;pwd=; connect timeout=30; "/>
      </connectionStrings>
      <appSettings>
        <add key="ConnectionString" value ="Data Source=192.168.0.100;Initial Catalog=SimCarSys; user id=sa;pwd=;"/>  </appSettings>
      <configSections>
        <!-- 要加载的配置文件 -->
        <section name="SysInit" type="System.Configuration.NameValueSectionHandler" />
      </configSections></configuration>