2010-02-01 66 views
1

在ASP.NET中使用Facebook API按名稱進行FQL搜索不起作用。但是,這在5天前工作正常。最近,當我在ASP.NET中使用FQL(Facebook API)按名稱查找人員時,它不起作用。在使用Facebook API的ASP.NET中按名稱進行FQL搜索不起作用?

最近,facebook開發者團隊在做了一些修改後部署了Facebook API。

我可以得到以下FQL響應:

select name, first_name, last_name from user where uid = '1730923544' 

我無法得到以下FQL響應(但我可以得到空字符串)

select name, pic_square, profile_url from user where name = 'Suresh Rajan' 

這裏是我完整的代碼:

public partial class _Default : System.Web.UI.Page 
{ 
    facebook.Components.FacebookService _fb = null; 

    public _Default() 
    { 
     _fb = new FacebookService(); 
     _fb.ApplicationKey = "bfeefa69afdfe81975f0d6136ace3009"; 
     _fb.Secret = "9b672d682e1d8befd06382953fc2615b"; 
     _fb.IsDesktopApplication = false; 
    } 

    protected void Page_Load(object sender, EventArgs e) 
    { 
     infobel_FacebookMethod();   
    } 

    private void infobel_FacebookMethod() 
    { 
     try 
     { 
      string s = String.Empty; 

      //I cannot have response for this fql (but getting empty string) 
      //s = _fb.fql.query("select name, profile_url from user where name = 'Suresh Rajan'"); 

      //Here I can get response 
      s = _fb.fql.query("select name, from user where uid = '1730923544'"); 

      if (String.IsNullOrEmpty(str1)) 
       Response.Write("Empty Response"); 
      else 
       Response.Write(str1 + " <br />");    
     } 
     catch (Exception exp) 
     { 
      Response.Write("Message = " + exp.Message + "<br />"); 
      Response.Write("ToString = " + exp.ToString()); 
     } 
    } 
} 

如何在ASP.NET中編寫FQL?

感謝

+0

我覺得你是在一個記錄只搜索...還是我錯 – jjj 2010-02-01 05:46:13

+0

這也許幫助>> HTTP:/ /www.codeproject.com/KB/aspnet/LinqToFqlAddon.aspx – jjj 2010-02-01 05:47:45

+0

但是 _fb.fql.query(「select name,profile_url from user where'='Suresh Rajan'」); //這個FQL是retured響應10天前.. 僅上週,我無法獲得來自Facebook API響應.. 任何想法,,, 感謝 重新 – user263249 2010-02-01 06:00:58

回答

0

當我運行FQL select name, profile_url from user where name = 'Suresh Rajan'我得到以下錯誤消息。

(#604)您的聲明不可索引。 WHERE子句必須包含 可索引列。這樣的列標有*從http://developers.facebook.com/docs/reference/fql

鏈接表 在如此看來,name屬性是不是你可以有一列的where子句。

然而,有可能是另一種方式來獲得你正在尋找,使用從圖形API搜索命令中的信息(見https://developers.facebook.com/docs/reference/api/

格式:https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE

例子:https://graph.facebook.com/search?q=mark&type=user

因此,你玩這個去:https://developers.facebook.com/tools/explorer

快樂的編碼!

0

只能查詢中使用的列名在某些特殊情況下,像這樣:select name, uid from user where name = 'Sergio Garcia' AND uid in (SELECT uid2 FROM friend WHERE uid1 = me())