Saturday, November 17, 2012

Show a string from an ASP.NET web service method on Windows Phone 7

So, I think this is a very simple question. I am making an app for Windows Phone 7 which communicates with a data base through an ASP.NET web service. There's a method in this web service that returns a string. Since I am fairly new to programming in general, I don't know how can I "get" and show this string.

Would anyone be so kind as to make a little code snippet that shows how to output this returned string to, say, a TextBlock?

The following is the web service method that I'm using. I apologize for the spanish names, but I'm afraid of messing something up if I translate.

public string Agregar_Usuario(string email, string pass, string nom, string ape, char gen, string dni, string tel, string ciudad)     {         string resultado;         SqlParameter res = new SqlParameter();         res.ParameterName = "@RESULTADO";         res.SqlDbType = SqlDbType.VarChar;         res.Size = 30;         res.Direction = ParameterDirection.Output;         abrirconexion();         query.CommandText = "AGREGAR_USUARIO";         query.CommandType = CommandType.StoredProcedure;         query.Connection = coneccion;         query.Parameters.Add("@EMAIL", SqlDbType.VarChar, 50).Value = email;         query.Parameters.Add("@CONTRA", SqlDbType.VarChar, 20).Value = pass;         query.Parameters.Add("@NOMBRE", SqlDbType.VarChar, 20).Value = nom;         query.Parameters.Add("@APELLIDO", SqlDbType.VarChar, 20).Value = ape;         query.Parameters.Add("@GENERO", SqlDbType.Char, 1).Value = gen;         query.Parameters.Add("@DNI", SqlDbType.VarChar, 20).Value = dni;         query.Parameters.Add("@TELEFONO", SqlDbType.VarChar, 9).Value = tel;         query.Parameters.Add("@CIUDAD", SqlDbType.VarChar, 20).Value = ciudad;         query.Parameters.Add(res);         query.ExecuteNonQuery();         resultado = query.Parameters["@RESULTADO"].Value.ToString();         cerrarconexion();         return resultado;     } 

Source: http://stackoverflow.com/questions/13428890/show-a-string-from-an-asp-net-web-service-method-on-windows-phone-7

epidermolysis bullosa miss wisconsin law abiding citizen golden globes 2012 miss america lana del rey saturday night live focus on the family

No comments:

Post a Comment