Member Avatar for lithium112

Hi,

I was just playing around with using a linq query on a dataTable that has information from sql. I was using

var q = from Email in dtEmail.AsEnumerable()
                                where Email.Field<string>("Email") == "yay"
                                select Email;

But for some reason it will not query the email datatable. And yes, I actually did put yay in one of the cells if anyone is wondering. (like I said, I'm just playing around with it) When I pull the ID of one and set it to an int in the query, it pulls just fine, but whenever I try a string, it doesn't pull anything. Does anyone know what might be causing this?

Is the datatype property of that column set?

Member Avatar for lithium112

Yes, it is set to an nvarchar but it still will not detect the column for some reason.

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.