Esempio n. 1
0
 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();
         }
     }
 }
Esempio n. 2
0
 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();
         }
     }
 }