0

I'm trying to convert a functional hard code query to a dinamic query. With my knowledge this is a impossible task.

Can anybody help me? This is the hard code query. This works fine:

Dim ret0 = qry.AsQueryable.Select(Function(f) New With { f.id, f.bint1, f.scampo1}) 

Where qry is a "return content table" comes from another query.

I've try:

Dim ret99 = qry.AsQueryable().Select(Function(f) ("new (key.id, key.bint1, key.scampo1)"))

and other variations but not is working.

If I do something like that:

Dim ret1 = qry.AsQueryable().Select("scampo1")

this works fine. But if I try more than one column only the very first one is returned.

Hope somebody could help me on that.

Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459
  • Are you speaking about Dynamic LINQ package? If yes, then you should be using simply `.Select("new (key.id, key.bint1, key.scampo1)")` (i.e. `String`, not `Function` argument) – Ivan Stoev Jun 01 '17 at 14:56
  • 1
    I've try that and get an error "Message = "No property or field 'key' exists in type 'tbDoc'". Then I could realize that is just a matter of remove the "Key" and all is working. Thanks for the tip. This is the correct sintax: Dim ret99 = qry.AsQueryable().Select("new (id, bint1, scampo1)") – Rogerio Picilli Jun 01 '17 at 15:11

0 Answers0