I'm new to WCF, and I have to return data from SQL, without knowing table schema.
I wanted to return DataTable from method, but I found that this is not a good practice.
So my question is what is the best solution for this problem?
I am not sure about your situation. However, I suggest you should mapping data inside datatable into a simple object, mark it as
Datacontract and transfer it as remote object, some of relevant techniques at here are POCO and DTO (Data Transfer Object) conceptual.
You can take reference from MSDN the article related to DTO which explain the case study why we should apply DTO when transfer remote objects.
From my experience, POCO lightweight, easy to configure and setup to transfer through WCF as well as traditional technical on network as Socket, pipeline.
You can look at this article from Code project it will help you understand and figure out the best way transfer data by apply POCO
Hope this help.