Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/04/2009, 11:50
Avatar de Dradi7
Dradi7
 
Fecha de Ingreso: junio-2008
Ubicación: Peru - Lima
Mensajes: 1.518
Antigüedad: 16 años, 8 meses
Puntos: 220
Respuesta: ¿Cómo nuestro el resultado de un SELECT?

[System.Web.Services.WebMethod()]
public int GetUserScore(string UserName){
SqlConnection conn = new SqlConnection(DBUtil.ConnectionString);

try
{
// Create the command object
conn.Open();
SqlCommand command = conn.CreateCommand();
command.CommandText = "SELECT max(resultado) AS maxim FROM plays " + " WHERE nombre = '" + UserName +"'; ";
command.CommandType = CommandType.Table;
return Convert.ToInt16(command.ExecuteScalar());
}
catch
{
return 0;
}
//return result;
}
__________________
La clave de todo triunfador es eliminar todas sus excusas y sus limitaciones