Hello,
when I write web method using C# in Visual basic 2005,
I can't return the string value to the client request.
I got such kind of error Not all code paths return a value.
Don't know how to cope that problem.
My code is as follow.
Thanks in advance
when I write web method using C# in Visual basic 2005,
I can't return the string value to the client request.
I got such kind of error Not all code paths return a value.
Don't know how to cope that problem.
My code is as follow.
Thanks in advance
Code:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://www.tp.edu.sg/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class CountryLanguage : System.Web.Services.WebService
{
public CountryLanguage()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod(Description = "Return official language of particular country.")]
public string OfficialLanguage(string country)
{
string l = "Singapore"; string r = "English";
//if(l.CompareTo(country)==0)
int res = String.Compare(country,l);
if (res == 0)
{
return r;
}
}
Comment