Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------
- | id | fecha |
- ------------------------------
- | 1 | 2018-06-18 14:30:00 |
- | 2 | 2018-06-18 14:31:40 |
- ------------------------------
- public static DataTable Ultimo()
- {
- DataTable DtResultado = new DataTable("ultimo");
- NpgsqlConnection SqlCon = new NpgsqlConnection(Conexion.Cn);
- NpgsqlCommand SqlDat = new NpgsqlCommand(String.Format("select * from " + table + " order by fecha desc limit 1"), SqlCon);
- SqlCon.Open();
- NpgsqlDataReader dr = SqlDat.ExecuteReader(CommandBehavior.CloseConnection);
- DtResultado.Load(dr);
- dr.Close();
- SqlDat.Dispose();
- SqlCon.Close();
- return DtResultado;
- }
- public static DataTable PorFechaExacta(string date)
- {
- DataTable DtResultado = new DataTable("fechaExacta");
- NpgsqlConnection SqlCon = new NpgsqlConnection(Conexion.Cn);
- Console.Write(date);
- NpgsqlCommand SqlDat = new NpgsqlCommand(String.Format("select * from " + table + " where date(fecha)='"+date+"'"), SqlCon);
- SqlCon.Open();
- NpgsqlDataReader dr = SqlDat.ExecuteReader(CommandBehavior.CloseConnection);
- DtResultado.Load(dr);
- dr.Close();
- SqlDat.Dispose();
- SqlCon.Close();
- return DtResultado;
- }
Add Comment
Please, Sign In to add comment