Merge two requests for searches

46 views Asked by At

I am trying to merge two requests for searches.

This is my code

loadSearchData();

Kasa kasa = new Kasa();
DateTime startDate = textKochaniDataPrint.Value;

string razpiska;


while (startDate&&razpiska)

var AvtolistEntitiesNoShow = from a in db.Kasas
                             where (a.DateK.Date == startDate.Date) //&& (a.Razpiska == razpiska)
                             select a;



try
{
   razpiska = Convert.ToString(this.textKgkRazpiskaPrint.Text);
}
catch
{
   MessageBox.Show("Неправилен формат на кода - трябва да е цяло число!");
   return;
}

var napr = db.Kasas.Where(d => d.Razpiska == razpiska).FirstOrDefault();

try
{
   this.textKgkRazpiskaPrint.Text = kasa.Razpiska.ToString();

}
catch
{
   MessageBox.Show("Няма такова направление !");
   return;
}




}

private void loadSearchData()
{
    DateTime startDate = textKochaniDataPrint.Value;

    this.gridKochaniGlavnaKasaPrint.DataSource = db.Kasas.Where(d => d.DateK == startDate).ToList();

    string razpiska = Convert.ToString(this.textKgkRazpiskaPrint.Text);

    this.gridKochaniGlavnaKasaPrint.DataSource = db.Kasas.Where(r => r.Razpiska == razpiska).ToList();
    loadData();
}

and give me this error :

Error 1 Embedded statement cannot be a declaration or labeled statement = not a closed loop

Where is this loop or what i need to change to fix it ?

0

There are 0 answers