@Michal Thanks for your input. It put me on the right track. Found the right solution for me.
if (invoices.Count() == 1) { qry_order = (int)invoices.FirstOrDefault().orderId; }