Hello, I am trying to return just a simple string after executed a store procedure using restful in c# . This is my code (i know it is not a good code) <pre> public string Get(string numero) { string conexionString = ""; SqlConnection conexion = null; var answer = ""; try { conexion = new SqlConnection(); conexion.ConnectionString = conexionString; conexion.Open(); SqlCommand cmd = new SqlCommand("validar_cliente_factura", conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@CTE_NUMERO", numero); SqlParameter returnValue = new SqlParameter("@RESPUESTA", SqlDbType.NVarChar); returnValue.Direction = ParameterDirection.Output; cmd.Parameters.Add(returnValue); cmd.ExecuteNonQuery(); answer = (string)returnValue.Value; } catch (Exception) { } finally { conexion.Close(); } return answer; }
// GET api/values/5 public string Get(int id) { return "value"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)