如何在C#SDK中使用fql.multiquery

时间:2011-04-27 09:36:56

标签: facebook-c#-sdk facebook-fql fql.multiquery

我正在使用facebook-c#-sdk和VB。

我的代码:

dim facebook As New FacebookApp()

dim queries as string=" ""2011-4-13"" : ""SELECT metric, value FROM insights WHERE object_id=173249789387842 AND metric='page_active_users' AND end_time=end_time_date('2011-4-13') AND period=period('day')"",""2011-4-14"" : ""SELECT metric, value FROM insights WHERE object_id=173249789387842 AND metric='page_active_users' AND end_time=end_time_date('2011-4-14') AND period=period('day')"""

dim oFQLResult As Object = facebook.Query(queries )

我得到: Facebook.FacebookApiException:Parser错误:0位意外'\'。

单个查询完美无缺。进行多查询的正确方法是什么?

谢谢!

1 个答案:

答案 0 :(得分:2)

您可能想查看这些nuget包。 (样品在C#中)

Install-Package Facebook.Sample
Install-Package Facebook.Sample.Dynamic

以下是C#中的示例。

        var query1 = "SELECT uid FROM user WHERE uid=me()";
        var query2 = "SELECT profile_url FROM user WHERE uid=me()";

        try
        {
            var fb = new FacebookClient(accessToken);

            var result = (IList<object>)fb.Query(query1, query2);

            var result0 = ((IDictionary<string, object>)result[0])["fql_result_set"];
            var result1 = ((IDictionary<string, object>)result[1])["fql_result_set"];
        }
        catch (FacebookApiException ex)
        {
            // Note: make sure to handle this exception.
            throw;
        }