public DataTable Mostrar() { comando.Connection = conexion.AbrirConexion(); comando.CommandText = "mostrar_empleado"; comando.CommandType = CommandType.StoredProcedure; leer = comando.ExecuteReader(); tabla.Load(leer); conexion.CerrarConexion(); return(tabla); }
public DataTable Mostrar() { comando.Connection = conexion.AbrirConexion(); comando.CommandText = "mostrar_producto"; comando.CommandType = CommandType.Text; leer = comando.ExecuteReader(); tabla.Load(leer); conexion.CerrarConexion(); return(tabla); }
public void cargarEmpleados(ComboBox cmb) { cmb.ToString(); CDConexion conexion = new CDConexion(); DataTable dt = new DataTable(); using (conexion.AbrirConexion()) { string query = "select * from empleado order by [Nombre de Empleado]"; SqlCommand cmd = new SqlCommand(query, conexion.AbrirConexion()); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); } cmb.DisplayMember = "Nombre de Empleado"; cmb.ValueMember = "id"; cmb.DataSource = dt; conexion.CerrarConexion(); }
public void cargarTipos(ComboBox cmb) { cmb.ToString(); CDConexion conexion = new CDConexion(); DataTable dt = new DataTable(); using (conexion.AbrirConexion()) { string query = "select * from tipoUsuario"; SqlCommand cmd = new SqlCommand(query, conexion.AbrirConexion()); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); } cmb.DisplayMember = "Tipo de usuario"; cmb.ValueMember = "id"; cmb.DataSource = dt; conexion.CerrarConexion(); }
public void cargarMunicipio(ComboBox comboBox1) { comboBox1.ToString(); CDConexion conexion = new CDConexion(); DataTable dt = new DataTable(); using (conexion.AbrirConexion()) { string query = "select * from municipio order by Municipio"; SqlCommand cmd = new SqlCommand(query, conexion.AbrirConexion()); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); } comboBox1.DisplayMember = "Municipio"; comboBox1.ValueMember = "id"; comboBox1.DataSource = dt; conexion.CerrarConexion(); }
public SqlDataReader logearse(string user, string pass) { SqlCommand comando = new SqlCommand("logearse", conexion.AbrirConexion()); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@usuario", user); comando.Parameters.AddWithValue("@pass", pass); leer = comando.ExecuteReader(); comando.Parameters.Clear(); return(leer); }