For some reason when i run this link statement I get this error not sure why am I getting it but it doesn't make any sense. I am not even doing a conversion. the field I am counting is a string field but the alias is a variable.


Conversion failed when converting the varchar value 'LP8302' to data type bit.

Dim get_replen = (From d In db.pckwrks
                        Where d.wrktyp = "RPLN"
                        Order By d.pckseq Ascending
                        Group d By d.part_id, d.toloc_id, d.loc_id Into g = Group
                        Select part_id, toloc_id, loc_id, LP_Count = g.Count(Function(p) p.inv_id), Tot_qty = g.Sum(Function(t) t.pckqty)).First

I fixed it somehow by applying .count to the invid not sure why that works but it is weird. Thanks for help anyways.

Dim get_replen = (From d In db.pckwrks
                        Where d.wrktyp = "RPLN"
                        Order By d.pckseq Ascending
                        Group d By d.part_id, d.toloc_id, d.loc_id Into g = Group
                        Select part_id, toloc_id, loc_id, LP_Count = g.Count(Function(o) o.inv_id.Count), Tot_qty = g.Sum(Function(t) t.pckqty)).First
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.