java - How can I get data from Azure Mobile services -
i trying data azure ms sql database azure mobile services. wrote code below when call method returns null. doing wrong? query should use?
private void refreshnumsfromtable() { new asynctask<void, void, void>() { @override protected void doinbackground(void... params) { try { runonuithread(new runnable() { @override public void run() { mphonestable.where().field("phonenumber").execute(new tablequerycallback<phonenumbers>() { @override public void oncompleted(final list<phonenumbers> result, int count,exception exception, servicefilterresponse response) { runonuithread(new runnable() { @override public void run() { madapter.clear(); for(phonenumbers num : result) { madapter.add(num); } } }); } }); } }); } catch (exception e) { createandshowdialog(e, "error"); } return null; } }.execute(); }
you don't have complete predicate there. using where()
method, you're asking results phonenumber meets criterion, aren't specifying criterion. need it's equal (eq()
) or starts string:
mphonestable.where().field("phonenumber").eq("555-555-5555").execute().get();
or mphonestable.where().startswith("phonenumber", "555").execute().get();
if you're trying return phonenumber column, use select()
method:
mtodotable.select("phonenumber").execute().get();
for more information, please see mobile services android sdk reference: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-android-how-to-use-client-library/#querying
Comments
Post a Comment