I have my FQL query and i have my access token. But how do i display FQL results in GRID VIEW using C# and ASP.NET?
FQL:
SELECT uid, username, first_name, last_name, friend_count, pic_big
FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
This is what i have tried:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Facebook;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
var fb = new FacebookClient("{My Access Token}");
dynamic result = fb.Get("/me");
var name = result.name;
MessageBox.Show("Hi " + name);
}
}
}
I have realized that the data is returned from Facebook as JSON so i attempt to deserialize
but still now luck.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Facebook;
using System.Dynamic;
using Newtonsoft.Json;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public class MyFriends
{
public int uid {get; set;}
public string username {get; set;}
public string first_name {get; set;}
public string last_name {get; set;}
public int friend_count {get; set;}
public string pic_big {get; set;}
}
private void button1_Click(object sender, EventArgs e)
{
var fb = new FacebookClient("2A64ZAIeJVIbdZAxXRZCwYf5Bg27OgZDZD");
var query = string.Format("SELECT uid, username, first_name, last_name, friend_count, pic_big FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())");
dynamic parameters = new ExpandoObject();
parameters.q = query;
dynamic results = fb.Get("/fql", parameters);
results = JsonConvert.DeserializeObject<MyFriends>(results);
//MessageBox.Show("Hi " + results);
}
}
}