Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Element with special Character in LINQ?

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,207
0
0
US
Tableimport is a table in a dataset read from Excel using OleDB.

The problem I am trying to solve is that the data returned is giving every row in the sheet.

I am still trying to wrap my mind around LINQ but the below seems like it would be correct from the examples I've seen as RQ# is a unique field which is what I expect is what is required to enumerate. But # is a special language character so I am at a loss as to how to tell LINQ / .NET that is an element name. If it were SQL, I know it would be [RQ#].

Code:
Dim query = (From RQ# In TableImport.AsEnumerable)

Once that works, I am curious as to whether I need a where clause... If LINQ enumerates over the element, does it skip the blanks (duplicates)? I can see it working either way.
 
I ended up going with the less favorable Exit for looping over the rows in the data table.

Out of curiosity I am wondering if there is a solution for the original post. I am leaning towards know but none the less curious. My hunch is there are any number of workarounds but no syntax solutions. A query that aliases the problem enumerable field comes to mind as a possible solution.

Hoping to be wrong as I can see this coming up often enough to be annoying in general.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top