How do I query multiple conditions, and when one of the conditions is empty is ignored, and the other conditions apply ?
this Is My Code
var SalesAsInt = Convert.ToInt32(txtSalesNo.Text);
var YearAsInt = Convert.ToInt32(cbxYear.Text);
var MonthAsInt = Convert.ToInt32(cbxMonth.Text);
var DayaAsInt = Convert.ToInt32(cbxDay.Text);
using (var dbcontext = new Database.SalesEntities())
{
BindingSource VSalesIncome = new BindingSource();
VSalesIncome.DataSource = dbcontext
.VSalesIncomes
.Where(u => u.SalesCode == SalesAsInt )
.Where(u => u.YearIncome == YearAsInt)
.Where(u => u.MonthIncome == MonthAsInt)
.Where(u => u.DayIncome == DayaAsInt)
.ToList();
dgvadministration.DataSource = VSalesIncome;
}
Error When any text box is Empty
System.FormatException: 'Input string was not in a correct format.'