title: What's wrong with this function. unable to return string value
body: <pre><code>public static string GetContentFromSPList(string cValueToFind)
  {   
      string cValueFound = "";
      try
      {
          SPSecurity.RunWithElevatedPrivileges(delegate()
          {
              using (SPSite site = new SPSite("http://mysite"))
              {
                  site.AllowUnsafeUpdates = true;
                  using (SPWeb web = site.OpenWeb())
                  {
                      web.AllowUnsafeUpdates = true;
  
                      SPList oListAbout = web.Lists["About"];
                      SPQuery oQuery = new SPQuery();
  
                      oQuery.Query = "&lt;OrderBy&gt;&lt;FieldRef Name='myField' /&gt;&lt;/OrderBy&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='myField' /&gt;&lt;Value Type='Choice'&gt;" + cValueToFind + "&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;";
  
                      SPListItemCollection collListItems = oListAbout.GetItems(oQuery);
  
                      foreach (SPListItem oListItem in collListItems)
                      {
                          cValueFound = (oListItem["FieldContents"] != null ? oListItem["FieldContents"].ToString() : "");
                      }
                  }
              }
              return cValueFound;
          });
          //return cValueFound;
      }
      catch (Exception ex)
      {
      }
      finally
      {
          //return cValueFound;
      }
  }
  </code></pre>
  
  <p>Above is the piece of code. </p>
  
  <p>Problem is not allowing to return the string. It keeps on giving compilation errors. I am sure I am doing something wrong!!.</p>
  
  <p>Thanks.</p>