Abdul Samad

Abdul Samad

  • NA
  • 6
  • 887

How create a login in window phone using web service

Oct 28 2014 3:05 AM
Hello im beginner in programming skill . i m creating  a window phone 8 application where simple a user is creating a account and login ..
i have made the  code in web service  using stored procedure  . web service is run fine . in webform but i cant make  that run in window phone 8 app . 
plz . tell me how to do it . login with webservices in window phone  
 
 Web service 
public DataSet Login(string username, string password)
{
string pwdhash = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1");
SqlConnection con = new SqlConnection(strcon);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "loginProcedure";
SqlParameter param = new SqlParameter("@username", username);
SqlParameter param2 = new SqlParameter("@password", pwdhash);
cmd.Parameters.Add(param);
cmd.Parameters.Add(param2);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
 
window phone  
private void button1_Click(object sender, RoutedEventArgs e)
{
SnaprintWebserviceReferance.SnaPrintWebServiceSoapClient obj = new SnaprintWebserviceReferance.SnaPrintWebServiceSoapClient();
obj.aloginCompleted += new EventHandler<SnaprintWebserviceReferance.aloginCompletedEventArgs>(obj_aloginCompleted);
obj.aloginAsync(textBox1.Text, textBox2.Text);
Data ds = obj.aloginAsync(textBox1.Text, textBox2.Text);
if (ds.Tables[0].Rows.Count > 0)
{
label1.Text = "Hi ," + ds.Tables[0].Rows[0][1].ToString();
}
else
{
label1.Text = "Check  UserName or Password.";
}
}