Click here to Skip to main content
14,869,347 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
public async void UserLogin(string username, string password)
       {
           Cursor.Current = Cursors.WaitCursor;
           // show progress hud
           // New Thread : Call lines below

           string ENC = EN.encryptDecrypt(password);
           var query = ParseObject.GetQuery("Admins")
               .WhereEqualTo("userName", username)
               .WhereEqualTo("password", ENC);

          IEnumerable<ParseObject> results = await query.FindAsync();//Here is error

           if(results.Count() > 0)
           {

               user = results; /// here is error msg
           }
           else
           {
               MessageBox.Show("No");
           }

          return user;
       }


What I have tried:

I have tired to trying a lot anyone here can help me about who using parse SDK with .net c#
Posted
Updated 13-Jul-17 1:09am
Comments
George Swan 12-Jul-17 15:57pm
   
Try this
user =(ParseObject) results; // here is error msg

You claim the error is in two places, which one is it? Also your UserLogin method is void so you can't return anything (you are trying "return user", you can only just "return"). Next I don't see how this line

IEnumerable<ParseObject> results = await query.FindAsync();


can give the error you have posted, unless it's the FindAsync causing the issue (ie something in your query).

Regardless you are getting this error because you have a variable of type ParseObject and you are assigning something pf type IEnumerable<ParseObject> to that variable.

ParseObject po;
IEnumerable<ParseObject> pos = new List<ParseObject>();

po = pos; // error


po is ParseObject and pos is a collection of multiple ParseObjects so you can't assign one to the other. The solution depends on your business needs which we don't know. It could be you are expecting there to only be one object in your collection so you need to do something like this

po = pos.FirstOrDefault();


It's hard to say from what has been posted.
   
Comments
Member 13011362 13-Jul-17 7:09am
   
Thanks I have solved this issue..
Thanks I have solved this issue..
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900