C# easier ways to filter values in data-grid by month
Why not something simple like this:
var filter = Months.SelectedIndex == 0 ? null : 
    $&quot; where month(date_purchased) = {Months.SelectedIndex};&quot;

Also that dictionary initialization code is a lot of copy &amp; paste, you could easily write it like this:
var allOptions = new Dictionary&lt;string, string&gt;()
{
    [&quot;0&quot;] = &quot;All&quot;
};

int idx = 1;
foreach(var month in DateTimeFormatInfo.CurrentInfo.MonthNames)
    allOptions.Add((idx++).ToString(), month);

Edit: also don't use data sets if you're only returning one data table, use the table versions of the database API instead.