c# - Using WebService to return list Windows Phone 7 -


i'm new windows phone 7. have following code windows phone , webservice, need return list textbox can display result. can me out?

this xaml.cs code

public list() {      initializecomponent();     webservice.servicesoapclient ws = new webservice.servicesoapclient();     ws.retrieveallusercompleted += new eventhandler<webservice.retrieveallusercompletedeventargs>(retrievealluser);     ws.retrievealluserasync(); } void retrievealluser(object sender, webservice.retrieveallusercompletedeventargs e) {        //display result webservice using list     //tb_user.text = "";   } 

this code webservice

[webmethod] public list<userdal> retrievealluser() {     list<userdal> ulist = new list<userdal>();     userdal user = new userdal();     ulist = user.retrievealluser();     return ulist; } 

this code userdal.cs

public list<userdal> retrievealluser() {     list<userdal> dal = new list<userdal>();     try     {         using (sqlconnection conn = new sqlconnection(connstring))         {             using (sqlcommand mycommand = new sqlcommand("select * useraccount", conn))             {                  conn.open();                 sqldatareader dr = mycommand.executereader();                 while (dr.read())                 {                     username = dr["username"].tostring();                     password = dr["password"].tostring();                     dal.add(new userdal(username, password));                 }                 conn.close();                 dr.close();                 dr.dispose();             }         }     }     catch (sqlexception ex)     {         //result = 0;     }     return dal; } 

so can me out?


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -