I call an ajax enabled wcf service method ,
<script type="text/javascript">
function GetEmployee() {
Service.GetEmployeeData('1','5',onGetDataSuccess);
}
function onGetDataSuccess(result) {
Iteratejsondata(result)
}
</script>
and my method is ,
[OperationContract]
public string GetEmployeeData(int currentPage,int pageSize)
{
DataSet ds = GetEmployeeViewData(currentPage,pageSize);
return GetJSONString(ds.Tables[0]);
}
My Dataset ds contains three datatable but i am using the first one for my records…
Other two datatables have values how can i get them in result…
function onGetDataSuccess(result) {
Iteratejsondata(result)
}
Any suggestion…
The only suggestion: do not use DataSets over WCF!
DataSets are evil – they’re huge, they carry lots of overhead, the mix data with behavior – all things you should try to avoid like the plague when doing proper SOA. This is doubly true when you’re doing Ajax calls asynchronously – you want to transfer as little data as possible using JSON – and having a DataSet with DataTables does not help you at all for your JSON calls…
So really : get yourself acquainted with some kind of an ORM, and grab objects and lists of objects and toss the DataSets onto the digital recycling heap…..
For a small project, if you’re using SQL Server as your backend, why not use Linq-to-SQL? Or if that doesn’t work for you, check out Subsonic