0
I made a report screen to read some values from a database. When I type for example 01/05/2017(start date) and 31/05/2017 (end date) the bank returns me as wanted. But when I enter the final date for example (01/06/2017) the database returns me null. What should I do?
DateTime DT_IN_General = new DateTime();
DateTime DT_OUT_General = new DateTime();
DT_IN_General = Convert.ToDateTime(DateIn.Text);
DT_OUT_General = Convert.ToDateTime(DateOut.Text);
if ((string) LB_Name_Equip.Content != "Selecionar Equipamento") {
if (DateIn.Text != null) {
if (DateOut.Text != null) {
if (DT_IN_General < DT_OUT_General) {
if ((string) LB_Name_Equip.Content == "EL 02") {
DataGrid_ItemSource_Alarms_And_Events(Class.DataBaseSqlServerEquip.GetReportEvent_Table_EquipAlarmEvent(Convert.ToDateTime(DateIn.Value), Convert.ToDateTime(DateOut.Value), "_EL 02"));
}
public static DataTable GetReportEvent_Table_EquipAlarmEvent(DateTime DTIn, DateTime DTOut) {
DataTable Data = new DataTable();
try {
string CommandString = "SELECT * FROM EquipAlarmEvent WHERE Event = 'True' AND DateIn >= '" + DTIn + "' AND DateIn <= '" + DTOut + "' ORDER BY Id DESC;";
SqlConnection Call = new SqlConnection(ConnectionString);
SqlDataAdapter Adapter = new SqlDataAdapter(CommandString, ConnectionString);
Adapter.Fill(Data);
} catch (Exception ex) {
Screen.Window_Buffer_Diagnostic.List_Error = ex.ToString();
}
return RemoveUnderscoreAndSubscribeDate(Data);
you need to detail your question. How will we know if you have not entered the code? The more detailed your question the better.
– Renan
I recommend that you make a [tour] by the site and see [Ask].
– Francisco
SELECT * FROM Equipalarmevent WHERE Event = 'True' AND Datein >= '01/04/2017 00:00:00' AND Datein <= '01/07/2017 00:00:00' ORDER BY Id DESC Here what "I ask" for Bank
– Emanuel Rezende