public int AMBvisibilidad(publicar_dto dto) { int retorno = -1; try { /* * @idvisibilidad AS Numeric(18,0), * @descripcion AS Nvarchar(255), * @porcentaje_venta AS numeric(18,2), * @precio_publicacion AS numeric(18,2), * @precio_envio AS numeric(18,2), * @codigo AS numeric(18), * @estado AS bit, * @accion AS numeric(1)) */ using (var command = new SqlCommand("DALE_SA.ABMvisibilidad") { CommandType = CommandType.StoredProcedure }) { //var dt = new DataTable(); //create your own data table /* MessageBox.Show("idv"+dto.getidvisibilidad()); * * MessageBox.Show("D"+dto.getdescripcion()); * * MessageBox.Show("C"+dto.getidrubro()); * * MessageBox.Show("P"+dto.getporc()); * * MessageBox.Show("E"+dto.getcosto()); * * MessageBox.Show("Preci"+dto.getprecio()); * * MessageBox.Show("ACCION" + dto.gettipo_publicacion());*/ command.Parameters.AddWithValue("@idvisibilidad", dto.getidvisibilidad()); command.Parameters.AddWithValue("@descripcion", dto.getdescripcion()); command.Parameters.AddWithValue("@porcentaje_venta", dto.getporc()); command.Parameters.AddWithValue("@precio_publicacion", dto.getprecio()); command.Parameters.AddWithValue("@precio_envio", dto.getcosto()); command.Parameters.AddWithValue("@codigo", dto.getidrubro()); command.Parameters.AddWithValue("@estado", dto.getestado()); command.Parameters.AddWithValue("@accion", dto.gettipo_publicacion()); SqlParameter retval = command.Parameters.Add("@b", SqlDbType.Int); retval.Direction = ParameterDirection.ReturnValue; command.Connection = cnn; conectar(); command.ExecuteNonQuery(); retorno = (int)command.Parameters["@b"].Value; } System.Console.WriteLine("CONSULTA SQL OK"); } catch (Exception ex) { System.Console.WriteLine("Hubo un problema con la peticion"); System.Console.WriteLine("Execpcion decimal compra: " + ex.ToString()); //MessageBox.Show(ex.ToString()); System.Console.WriteLine("-1"); return(-1); } finally //si tiro error o si todo bien, cierra la sesion. { desconectar(); } System.Console.WriteLine("CONSULTA SQL OK33333"); return(retorno); }