Fadi Banna Fadi Banna - 1 year ago 84
C# Question

Adding and reading from from azure mobile service

I created a mobile service app using azure connected it to SQL DB that has this table
enter image description here

now trying to insert and retrieve data in my Windows Universal App gives me this error:
enter image description here

I tried many things one of them was this code:

HighScore item = new HighScore
SCORE = "100",
playerName = "Mark"

await App.MobileService.GetTable<HighScore>().InsertAsync(item);

tried also to get the table bu name but no luck, now what is weird for me is that this same code works perfectly on the TodoItem Table but not on other tables.

Thanks in advance

Answer Source

The MobileServiceInvalidOperationException is a wrapper exception. The actual exception is in an InnerException inside that object. Based on the error message, your insert is not working.

You have provided no information on how you constructed the backend. Don't forget that you need to create the table in the SQL database and you need to create an appropriate controller for exposing the database table to your mobile client.

You have not provided any information on what the entity on your mobile client looks like. It needs to match the information you want to send to the backend.

Finally, take a look at my book - http://aka.ms/zumobook - Chapter 3 of the book goes into great detail on the data protocol.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download