Returning DataTables in WCF/.NET

前端 未结 8 1588
广开言路
广开言路 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:41

    I added the Datable to a data set and returned the table like so...

    DataTable result = new DataTable("result");
    
    //linq to populate the table
    
    Dataset ds = new DataSet();
    ds.Tables.Add(result);
    return ds.Tables[0];
    

    Hope it helps :)

提交回复
热议问题