When i use my code shown below it seems to select all data within the same year rather than within the current month. Is this a potential format issue as my data base is dd/mm/yyyy and if this is the case how would i format my date variables to match. My code is shown below and i have researched this issue and cannot work out its cause so any help would be great.
private void LabelProfit()
{
//Set date
DateTime now = DateTime.Now;
var startDate = new DateTime(now.Year, now.Month, 1);
var endDate = startDate.AddMonths(1).AddDays(-1);
//ERROR WITH BETWEEN STATEMENT
//Select Income
con.Open();
OleDbCommand cmd = new OleDbCommand("SELECT SUM(Income) FROM Finance WHERE TransactionDate BETWEEN #" + startDate.ToShortDateString() + "# AND #" + endDate.ToShortDateString() + "#");
cmd.Connection = con;
decimal Income = decimal.Parse(cmd.ExecuteScalar().ToString());
//Select Expenditure
OleDbCommand cmd2 = new OleDbCommand("SELECT SUM(Expenditure) FROM Finance WHERE TransactionDate BETWEEN #" + startDate.ToShortDateString() + "# AND #" + endDate.ToShortDateString() + "#");
cmd2.Connection = con;
decimal Expenditure = decimal.Parse(cmd2.ExecuteScalar().ToString());
con.Close();
// Creates Output for label
decimal sum = Income - Expenditure;
string output = $"{sum:C2}";
lblProfitLoss.Text = output.ToString();
}