how to consume wcf service in windows phone app
-
martedì 10 aprile 2012 10:04
Hi Friends,
I am new to developing apps in windows phone can any one tell me the client side code
I created windows azure project(for connect with sql azure project)using EDM
Here is my server side code
[ServiceContract]
public interface IService1
{
[OperationContract]
void Insert(emp x);
}[DataContract]
public class emp
{
[DataMember]
public int id;
[DataMember]
public string name;
[DataMember]
public int sal;
[DataMember]
public string paswrd;
}public static class convert
{
public static employee ConvertempToemployee(emp x)
{
employee b = new employee();
b.ID = x.id;
b.Name = x.name;
b.Salary = x.sal;
b.password = x.paswrd;
return b;
}
}
public trubyteEntities y;
public void Insert(emp x)
{
y = new trubyteEntities();
employee insrt = convert.ConvertempToemployee(x);
y.AddObject("employees", insrt);
y.SaveChanges();}
Here is my Client side code
private ServiceReference1.Service1Client a;
// Constructor
public MainPage()
{
InitializeComponent();
a = new ServiceReference1.Service1Client();
a.InsertCompleted+=new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(a_InsertCompleted);
textBox1.Text=e
}
private void button1_Click(object sender, RoutedEventArgs e)
{
a.InsertAsync(
//here it showing server class emp
}but I dont know the next steps
what should I have to pass and how to pass
srujanna
Tutte le risposte
-
martedì 10 aprile 2012 10:39
Hello,
This got nothing to do with SQL Azure, you should post your question to a more related forum, like for Phone7: http://social.msdn.microsoft.com/Forums/en-us/windowsphone7series/threads
Olaf Helper
* cogito ergo sum * errare humanum est * quote erat demonstrandum *
Wenn ich denke, ist das ein Fehler und das beweise ich täglich
Blog Xing -
martedì 10 aprile 2012 10:42Postatore
have a look at these:
http://msdn.microsoft.com/en-us/gg598945
your question is more of a windows phone question rather than sql azure and you may get more replies if you post this on the windows phone forums: http://forums.create.msdn.com/forums/98.aspx

