Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I am trying to pass data from Web service to windows mobile application using c#.

I have tried to return datatable from web service but getting errors in windows mobile application as it is not supporting.

Now i am using below code to return data in list array. but i have no idea on how to access this list array in windows application.


[WebMethod]
public List<company> GetCompanies()
{
DataTable data = GetCompanyList();

List<Company> companydtls = new List<Company>();

// return the table as XML.
System.IO.StringWriter writer = new System.IO.StringWriter();
data.WriteXml(writer, XmlWriteMode.WriteSchema, false);

foreach (DataRow dtrow in data.Rows)
{
Company user = new Company();
user.CId = dtrow["Id"].ToString();
user.CName = dtrow["Name"].ToString();
companydtls.Add(user);
}


//returning array
return companydtls;

}


public class Company
{
public string CName { get; set; }
public string CId { get; set; }

}



Please let me know if you have any solution to resolve above issue. very urgent.

Thanks in Advance,
Tiru
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900