public void EliminarVisitante(Visitante v) { try { command.CommandText = "DELETE FROM Visitas WHERE Nombre=" + v.getNombre(); command.CommandType = System.Data.CommandType.Text; connection.Open(); command.ExecuteNonQuery(); } catch (Exception) { throw; } finally { if (connection != null) { connection.Close(); } } }
public void InsertarVisitante(Visitante v) { try { command.CommandText = "INSERT INTO Visitas (Nombre,Apellido,Sexo,Asunto,Relacion) VALUES ('" + v.getNombre() + "', '" + v.getApellido() + "','" + Convert.ToInt16(v.getSexo()) + "','" + v.getAsunto() + "', '" + v.getRelacion() + "')"; command.CommandType = System.Data.CommandType.Text; connection.Open(); command.ExecuteNonQuery(); } catch (Exception) { throw; } finally { if (connection != null) { connection.Close(); } } }
public void ActVisitantes(Visitante v) { try { command.CommandText = "UPDATE Visitas SET Nombre=" + v.getNombre() + "Apellido=" + v.getApellido() + "Sexo=" + v.getSexo() + "Asunto=" + v.getAsunto() + "Relacion=" + v.getRelacion() + " WHERE Nombre=" + v.getNombre(); command.CommandType = System.Data.CommandType.Text; connection.Open(); command.ExecuteNonQuery(); } catch (Exception) { throw; } finally { if (connection != null) { connection.Close(); } } }