2016-09-21 82 views
0

我正在使用Visual Studio 2012,現在我正在使用ReportViewer創建報告。爲此,我創建了一個DataSet對象來傳遞List作爲DataSource。問題是我的對象與嵌套的其他對象有關係,當我顯示對象時,報告列顯示#Erro。我正在尋找一些解決方案,但還沒有找到。具有#erro對象的ReportViewer字段?

我該怎麼做?

試圖

public class Conta { 

     public virtual long id      { set; get; } 
     public virtual Cliente cliente    { set; get; } 
     public virtual String historico    { set; get; } 
     public virtual DateTime dtLancamento  { set; get; } 
     public virtual DateTime dtVencimento  { set; get; } 
     public virtual decimal valorFinal   { set; get; } 

     public Conta() { 
     } 
    } 


public class Cliente { 
     public virtual int id    { set; get; } 
     public virtual string nome   { set; get; } 

     public Cliente() { 
     } 

     public override string ToString() { 
      return nome; 
     } 

    } 

的ReportViewer

enter image description here

回答

0

我找到了解決辦法,這是非常簡單的。僅在課堂上添加[Serializable]

我做

[Serializable] 
public class Conta { 

     public virtual long id      { set; get; } 
     public virtual Cliente cliente    { set; get; } 
     public virtual String historico    { set; get; } 
     public virtual DateTime dtLancamento  { set; get; } 
     public virtual DateTime dtVencimento  { set; get; } 
     public virtual decimal valorFinal   { set; get; } 

     public Conta() { 
     } 
    } 

[Serializable] 
public class Cliente { 
     public virtual int id    { set; get; } 
     public virtual string nome   { set; get; } 

     public Cliente() { 
     } 

     public override string ToString() { 
      return nome; 
     } 

    } 
相關問題