3

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;
    }

 }
}

screen capture

1 Answer 1

2

The name of the user class is "_User", so:

var userPointer = ParseObject.CreateWithoutData("_User", "og8wGxHKOm");
var query = ParseObject.GetQuery("Classifieds").WhereEqualTo("user", userPointer);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.