我装的是CR9,使用vs 2003.
在源文件里已经添加了:using CrystalDecisions.CrystalReports.Engine ;这一句.
生成时出现:找不到类型或命名空间名称(ReportDocument)(是否缺少using指令或程序集引用?)
行33
33行内容:ReportDocument oRpt = new ReportDocument();请问各位大哥,为什么会出现这样的错误?

解决方案 »

  1.   

    bin中有吗?在工程中添加CrystalDecisions引用
      

  2.   

    cystal report 版本:9.2.0.448
    不会跟这有关系吧?
      

  3.   

    除了 using 外, 还有添加引用一般在 VS 2003 的右边,解决方案管理器 中 点那个 引用,然后右键 选择“添加引用” 找到相应的  assembly(程序集)   也就是包含 CrystalDecisions 这个命名空间的 dll 动态连接库文件。 添加就是了
      

  4.   

    我第一次使用vs2003,还不会怎样添加crystalDecisions引用,能否说详细点呢?
      

  5.   

    可以生成了.好棒耶!
    可是我在浏览器打开rpview1.aspx时出现另一个错误:
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Line 44: 
    Line 45:  //建立.rpt文件与CryStalReportviewer文件之间的连接 
    Line 46:  CrystalReportViewer1.ReportSource=oRpt; 
    Line 47:  }
    Line 48:
      

  6.   

    Source File: c:\inetpub\wwwroot\csharpj\rpview1.aspx.cs    Line: 46 Stack Trace: 
    [AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
       CrystalDecisions.Web.ReportAgent.h() +317
       CrystalDecisions.Web.ReportAgentBase.set_ReportSource(Object value) +229
       CrystalDecisions.Web.ReportAgent.set_ReportSource(Object value) +14
       CrystalDecisions.Web.CrystalReportViewerBase.set_ReportSource(Object value) +36
       csharpj.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\csharpj\rpview1.aspx.cs:46
       System.Web.UI.Control.OnLoad(EventArgs e) +102
       System.Web.UI.Control.LoadRecursive() +47
       System
     
      

  7.   

    在解决方案资源管理器中,右击“引用”,选择“添加引用”,CrystalDecisions.CrystalReports.Engine 其实已经在列表中,只要选定它,点击“选择”,再点击“确定”就成
      

  8.   

    我把所有protected 改成了public,错误没有了,可是又出现另一个错误了:Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error: 
    Line 44:  override public void OnInit(EventArgs e)
    Line 45:  {
    Line 46:  //
    Line 47:  // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    Line 48:  //
     Source File: c:\inetpub\wwwroot\csharpj\rpview1.aspx.cs    Line: 46 Stack Trace: 
    [NullReferenceException: Object reference not set to an instance of an object.]
       CrystalDecisions.Web.ReportAgent.h() +317
       CrystalDecisions.Web.ReportAgentBase.set_ReportSource(Object value) +229
       CrystalDecisions.Web.ReportAgent.set_ReportSource(Object value) +14
       CrystalDecisions.Web.CrystalReportViewerBase.set_ReportSource(Object value) +36
       csharpj.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\csharpj\rpview1.aspx.cs:46
       System.Web.UI.Control.OnLoad(EventArgs e) +102
       System.Web.UI.Control.LoadRecursive() +47
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1064