This is only work for existing Customer in Ledger Table:
var i = (from u in dc.GetTable<Ledger>()
where u.C_Id == u.Customer.Id &&
u.Customer.Name == textBox1.Text
select u.Id).Max();
This is only work for new Customer in Ledger Table:
var i = (from u in dc.GetTable<Ledger>()
where u.C_Id == u.Customer.Id &&
u.Customer.Name == textBox1.Text
select u.Id).SingleOrDefault();
System.InvalidOperationException
occurred in System.Data.Linq.dll
Provide me the solution for both new and existing customer in Ledger Table. what is the query for getting Ledger Id for both case.