Advertisement
yepau

DAL Indicaciones

Aug 21st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Data.SqlClient;
  7. using System.Windows.Forms;
  8.  
  9.  
  10.  
  11. namespace ControlVacunasDAL
  12. {
  13.    public class Indicaciones
  14.     {
  15.         public int Id { get; set; }
  16.         public string sexo_aplica { get; set; }
  17.         public string Precauciones { get; set; }
  18.         public string contraindicaciones { get; set; }
  19.      
  20.         public void Save()
  21.  
  22.         {
  23.             var connection = new DBConnection().getConnection();
  24.  
  25.             string sql = $"INSERT INTO Mstr_Indicaciones (Ind_sexo_aplica,Ind_Precauciones, ind_contraindicaciones)  VALUES ('{sexo_aplica}', '{Precauciones}', '{contraindicaciones}') ;";
  26.  
  27.             SqlCommand command;
  28.  
  29.             try
  30.             {
  31.                 connection.Open();
  32.                 command = new SqlCommand(sql, connection);
  33.                 command.ExecuteNonQuery();
  34.             }
  35.             catch (Exception ex)
  36.             {
  37.                 MessageBox.Show(ex.Message);
  38.             }
  39.  
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement