Reputation: 33
I'm having some issue querying parse.com data. Here is my current code. I have a 'Classifieds' parse "table" which contains several fields. One of those is 'user' of type Pointer<_User> and contains the userid of the user who created an ad.
In my query, I wish to get all classifieds for a specific user. 'userid' of that user equals to 'og8wGxHKOm'. The query always returns null. Though, there is at least one ad (record) for that specific user as shown on the screen capture.
What am I missing ? - Working with latest Parse .Net SDK
namespace FindAllAds
{
public partial class _Default : Page
{
protected async void Page_Load(object sender, EventArgs e)
{
string x = await MyAds();
parselabel.Text = x;
}
private async Task<string> MyAds()
{
var query = ParseObject.GetQuery("Classifieds")
.WhereEqualTo("user", ParseObject.CreateWithoutData("User", "og8wGxHKOm"));
IEnumerable<ParseObject> results = await query.FindAsync();
//for testing only
string myString = "";
foreach (var value in results)
{
myString += value["title"] + "<br/>";
}
return myString;
}
}
}
Upvotes: 3
Views: 103
Reputation: 62686
The name of the user class is "_User", so:
var userPointer = ParseObject.CreateWithoutData("_User", "og8wGxHKOm");
var query = ParseObject.GetQuery("Classifieds").WhereEqualTo("user", userPointer);
Upvotes: 2