Another take would be to find dates between the first and last days in the month e.g.
DateTime dt1;
if (!DateTime.TryParse("01-" + cmddropdownlist1.SelectedText, out dt1))
{
return;
}
var firstDayNextMonth = dt1.AddMonths(1);
var dt2 = firstDayOfNextMonth.AddDays(-1);
var cmd = new SqlCommand(
"select BusinessCallYN,CallID,NewNam,CallDate,CalledNo,CallExt,CallDuration,Amount,tmpNewNam from MCALLERS where UserName=@email and CallDate between @dt11 and @dt2 and Amount>0 order by CallDate");
cmd.Parameters.AddWithValue("@dt1", dt1);
cmd.Parameters.AddWithValue("@dt2", dt2);
Note
- I've used command parameterization
- I've use the SQL BETWEEN comparison
- DateTime.TryParse to ensure the date is in the correct format
- I've assumed that column
CallDate
is a Date or DateTime type