I have the following WebMethod that returns a conditional string. Unfortunately the if statement doesn't seem to work. I know that the WebMethod is working because I get the Bla bla bla string but not the icons within the if statement. What am I doing wrong?
[WebMethod]
public static string photos()
{
StringBuilder photos_sb = new StringBuilder();
photos_sb.AppendFormat("Bla bla bla bla...");
db = Database.Open("DefaultConnection");
var HasPhoto = db.Query("SELECT [IDphoto] FROM [photos]");
if (HasPhoto != null)
{
photos_sb.AppendFormat("<img src=\"icon-Green.png\" />");
}
else
{
photos_sb.AppendFormat("<img src=\"icon-Gray.png\" />");
}
db.Close();
db.Dispose();
photos_sb.AppendFormat("Bla2 bla2 bla2 bla2...");
return photos_sb.ToString();
}