2010-02-01 37 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())

相关问题