Returning DataTables in WCF/.NET

前端 未结 8 1599
广开言路
广开言路 2020-12-01 05:00

I have a WCF service from which I want to return a DataTable. I know that this is often a highly-debated topic, as far as whether or not returning DataTables is a good pract

8条回答
  •  日久生厌
    2020-12-01 05:48

    There are 3 reason for failed return type as datatable in WCF services

    • You have to specify data table name like:

      MyTable=new DataTable("tableName");
      
    • When you are adding reference on client side of WCF service select reusable dll system.data

    • Specify attribute on datatable member variable like

      [DataMember]
      public DataTable MyTable{ get; set; }
      

提交回复
热议问题