Good evening everyone. First question. How to choose the desired day and time to show the report? I want when choosing a date you need to show the amount of this day. Question two: Where will the result of the query be saved and how can I take this result? Thanks in advance.
Code:
private void buttonProfit_Click(object sender, EventArgs e) { string query = "SELECT SUM(TotalSum) FROM TotalOutcomes WHERE Date_Time BETWEEN @dateBefore AND @dateAfter"; try { connection.Open(); command = new SQLiteCommand(query,connection); command.Parameters.AddWithValue("@dateBefore",dateTimePickerBeforeTotalOutcomes.Value.ToString()); command.Parameters.AddWithValue("@dateAfter",dateTimePickerAfterTotalOutcomes.Value.ToString()); command.ExecuteNonQuery(); SQLiteDataReader da = command.ExecuteReader(); if (da.Read()){/////} } catch(Exception ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } } Added SQLiteDataReader da = command.ExecuteReader (); if (da.Read ()) {/////} in da writes enumeration has not given results.