Exemple #1
0
 public DataTable Mostrar()
 {
     comando.Connection  = conexion.AbrirConexion();
     comando.CommandText = "MostrarConductores";
     comando.CommandType = CommandType.StoredProcedure;
     leer = comando.ExecuteReader();
     tabla.Load(leer);
     conexion.CerrarConexion();
     return(tabla);
 }
Exemple #2
0
        public void insertar(/*string placa, int color, int marca, int capacidad, string caracteristicas*/)
        {
            SqlCommand comando = new SqlCommand("insertarBus", conexion.AbrirConexion());

            comando.CommandType = CommandType.StoredProcedure;
            comando.Parameters.AddWithValue("@placa", this.placa);
            comando.Parameters.AddWithValue("@color", this.color);
            comando.Parameters.AddWithValue("@marca", this.marca);
            comando.Parameters.AddWithValue("@capacidad", this.capacidad);
            comando.Parameters.AddWithValue("@caracteristicas", this.caracteristicas);
            comando.ExecuteNonQuery();
            comando.Parameters.Clear();
        }
Exemple #3
0
        public List <CDCargos> mostrar()
        {
            List <CDCargos> leer2   = new List <CDCargos>();
            SqlCommand      comando = new SqlCommand("psMostrarCargos", conexion.AbrirConexion());

            comando.CommandType = CommandType.StoredProcedure;
            //comando.Parameters.AddWithValue("@var", this.var1);
            //comando.Parameters.AddWithValue("@var2", this.var2);
            //Si se desea insertar, modificar o eliminar cambiar la siguiente linea
            //por comando.ExecuteQuery()
            leer = comando.ExecuteReader();
            comando.Parameters.Clear();

            CDCargos crg;

            while (leer.Read())
            {
                crg       = new CDCargos();
                crg.Id    = leer.GetInt32(0);
                crg.Cargo = leer.GetString(1);
                leer2.Add(crg);
            }



            return(leer2);
        }
Exemple #4
0
        public void cargarColor(ComboBox comboBox1)
        {
            comboBox1.ToString();
            CDConexion conexion = new CDConexion();
            DataTable  dt       = new DataTable();

            using (conexion.AbrirConexion())
            {
                string         query = "select * from coloresBuses order by color";
                SqlCommand     cmd   = new SqlCommand(query, conexion.AbrirConexion());
                SqlDataAdapter da    = new SqlDataAdapter(cmd);
                da.Fill(dt);
            }

            comboBox1.DisplayMember = "color";
            comboBox1.ValueMember   = "id";
            comboBox1.DataSource    = dt;
            conexion.CerrarConexion();
        }
Exemple #5
0
        public SqlDataReader logearse()
        {
            SqlCommand comando = new SqlCommand("logearse", conexion.AbrirConexion());

            comando.CommandType = CommandType.StoredProcedure;
            comando.Parameters.AddWithValue("@email", this.email);
            comando.Parameters.AddWithValue("@pass", this.contrasenia);
            leer = comando.ExecuteReader();
            comando.Parameters.Clear();
            return(leer);
        }