Last post Jan 22, 2015 04:59 AM by morefays
Jan 22, 2015 04:03 AM|Sanfoor|LINK
i have a webmethod that return a data table as an output parameter.
i have a test application to test it like this
public void vFun(out DataTable dt)
DataTable dtINFO = GET_DATA();
dt = dtINFO;
in the test application, i just call the web service
DataTable dt=new DataTable();
but i have an error.
any help please?
Jan 22, 2015 04:11 AM|ajay.kalol|LINK
You have to write code like this :
DataTable dt = new DataTable();
I haven't check with webservice. but this is code how we can use out
Jan 22, 2015 04:59 AM|morefays|LINK
You can return DataTable in WebService.
You just need to give full DataTable name.
DataTable dt = new DataTable("YourTableName");
To return object in web service, Microsoft need to serialize the object.
At that time your data table object must has name. So, Microsoft will convert to XML like
If your table has no name, Microsoft cannot serialize as XML file. So, will be throw error.