public DataTable Lista() { try { DataTable tabla = new DataTable(); SqlCommand comando = new SqlCommand(); comando.Connection = conexion.AbrirConexion(); comando.CommandText = "select * from clientes where activo =1"; leer = comando.ExecuteReader(); tabla.Load(leer); leer.Close(); conexion.CerrarConexion(); return(tabla); } catch (Exception e) { Console.WriteLine(e.StackTrace); throw new Exception("Problemas"); } }
public DataTable Lista() { try { DataTable tabla = new DataTable(); SqlCommand comando = new SqlCommand { Connection = conexion.AbrirConexion(), CommandText = "select id,nombre,cuidad, canton, provincia, pais,activo from sedes where activo =1" }; leer = comando.ExecuteReader(); tabla.Load(leer); leer.Close(); conexion.CerrarConexion(); return(tabla); } catch (Exception e) { Console.WriteLine(e.StackTrace); throw new Exception("Problemas"); } }
public DataTable Lista() { try { DataTable tabla = new DataTable(); SqlCommand comando = new SqlCommand { Connection = conexion.AbrirConexion(), CommandText = "select id,nombre,primer_apellido,segundo_apellido,usuario,contrasenna,administrador_sede," + "dueño_veh,administrador,activo from usuarios where activo = 1" }; leer = comando.ExecuteReader(); tabla.Load(leer); leer.Close(); conexion.CerrarConexion(); return(tabla); } catch (Exception e) { Console.WriteLine(e.StackTrace); throw new Exception("Problemas"); } }