I have a method in my web service which returns a DataView,
I have setup a proxy which talks to this service but when i make this method in the proxy
public DataView GetSales(DateTime SalesDate)
{
ServiceClient client = new ServiceClient();
return client.GetSalesForDay(SalesDate);
}
I get the error “Cannot implicitly convert type ‘object[]’ to ‘System.Data.DataView’, i have tried googling this but not getting anywhere, any help would be much appreciated.
Thanks
You can’t do this – you cannot and should not return something like a DataView from a WCF service ever. A WCF service would only ever return data – not objects with behavior (DataView contains a lot of behavior – sorting, filtering, etc.).
Instead, in your service code, do this:
Instead of doing steps 1 and 2 yourself, you could also use Linq-to-SQL, NHibernate, or any other capable ORM to handle that conversion from row/columns in the database to an object for you.