问题
I am using the facebook-c#-sdk with VB.
my code:
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 )
I get: Facebook.FacebookApiException: Parser error: unexpected '\' at position 0.
A single query works perfect. What is the correct way to do multiqueries?
Thanks!
回答1:
You might want to check out these nuget packages. (Samples are in C#)
Install-Package Facebook.Sample
Install-Package Facebook.Sample.Dynamic
Here is sample in 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;
}
来源:https://stackoverflow.com/questions/5802037/how-to-use-fql-multiquery-with-c-sharp-sdk