MAcmd.CommandText = "select Sum(price) from sale where startdate='"+TextBox1.Text+"' and startdate='"+TextBox2.Text+"'";
startdate
cannot be equal to both values, unless they are the same string; is that what you expect?
I would also guard against using text strings for date comparisons, you should
always use
DateTime
values as they cannot be misinterpreted. Strings of the form
"10/12/2011"
are ambiguous; is that 10th of December or October 12th?