I am using dotConnect linq to sqlite. What i want to do is use two variable in a foreach loop. Followed this code but it is not working. This is my code snippet.
bool check_units(int id)
{
MainDataContext medic = new MainDataContext();
bool check = false;
var medic_query = from m in medic.Medicines
orderby m.Id
where m.Id == id
select m;
var invo_query = from inv in medic.Invoices
orderby inv.Id
where inv.Id == id
select inv;
var med_inv = medic_query.Zip(invo_query, (m, i) => new { Medicine = m, Invoice = i });
foreach(var mi in med_inv)
{
if (mi.Medicine.UNIT > mi.Invoice.UNIT)
{
mi.Medicine.UNIT -= mi.Invoice.UNIT;
if (mi.Medicine.UNIT < 10)
{
MessageBox.Show(mi.Medicine.Name + " is short in Invertory!\nUnits Remaining: " + mi.Medicine.UNIT,
"Inventory Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
chk = true;
}
else
{
MessageBox.Show("Not Enough Stock!\nUnits Remaining: " + mi.Medicine.UNIT,
"Inventory Short", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
medic.SubmitChanges();
return chk;
}
The Problem that i am facing is my code gives an error
The query operator 'Zip' is not supported.
There is no kind of syntax error or warning. I think that Zip operator can not be used with linqtosql type of queries!
Waiting for support! Thanks :)