Questions tagged [asenumerable]

32 questions
54
votes
4 answers

Understanding .AsEnumerable() in LINQ to SQL

Given the following LINQ to SQL query: var test = from i in Imports where i.IsActive select i; The interpreted SQL statement is: SELECT [t0].[id] AS [Id] .... FROM [Imports] AS [t0] WHERE [t0].[isActive] = 1 Say I wanted to…
Mike Fielden
  • 10,055
  • 14
  • 59
  • 99
4
votes
1 answer

How to write LINQ statement for XmlAttributeCollection?

I always confuse AsQueryable, AsEnumerable. When should I use them? Should I use AsQueryable to create a LINQ statement to make a filter according to attribute of xml or AsEnumerable? [Serializable] public class LogHandler :…
uzay95
  • 16,052
  • 31
  • 116
  • 182
4
votes
2 answers

c# using DataTable AsEnumerable() on .NET 2

I am trying to run the following code on a .net 2 winforms app: DataTable dt = this.GetData(null, null, true, sql); DateTime minDate = (from f in dt.AsEnumerable() select f.Field("Timestamp")).Min(); I am getting errors…
Funky
  • 12,890
  • 35
  • 106
  • 161
4
votes
3 answers

Datatable does not contain a definition for AsEnumerable using LinqBridge1.1 in C#2.0

i'm trying to use linq in c#2.0(linqbridge) to search for a patient name in my database, but i'm getting the following errors: System.Data.Datatable does not contain a definition for AsEnumerable() System.Data.Datatable does not contain a definition…
user1421676
  • 61
  • 1
  • 1
  • 4
2
votes
1 answer

Linq. How to use AsEnumerable within Linq (sql syntax) query? EF4.1

See two functionally identical queries below, sql and lambda version: from a in Lines.AsEnumerable() where a.LineId == SomeGuid select a - Lines.AsEnumerable() .Where(a => a.LineId == SomeGuid) .Select(a => a) Both queries will be translated into…
bobetko
  • 5,019
  • 14
  • 58
  • 85
1
vote
1 answer

MVC 3 Razor not displaying selected item from dropdown list

I have created a form with a dropdown list for 'Region'. Once the form has been submitted I want to be able to view the details from the form. In particular I want the name of the 'Region' to be displayed but I am currently getting the name, ID and…
1
vote
1 answer

Unity, How to use AsEnumerable

I need to use AsEnumerable() on a DataTable in Unity, but it seems the Unity version of System.Data doesn't have that method! I tried to import the VS version of dll into the asset, but it told me that Multiple assemblies with equivalent identity…
1
vote
2 answers

DataTable AsEnumerable matching a single value

Let's say my query returns a DataTable which is a list of email addresses, a single varchar column called "email"; these emails are authorized to do something. jane@doe.com mike@foo.com donald@duck.com And the current logged in user is…
Tim
  • 8,669
  • 31
  • 105
  • 183
1
vote
2 answers

Linq Queries containing "AsEnumerable()" equivalence

Are this 2 queries functionally equivalent? 1) var z=Categories .Where(s=>s.CategoryName.Contains("a")) .OrderBy(s => s.CategoryName).AsEnumerable() .Select((x,i)=>new {x.CategoryName,Rank=i}); 2) var…
S.Bozzoni
  • 998
  • 9
  • 18
1
vote
2 answers

datatable.AsEnumerable doesn't work (basic example)

Dim x = From row In f_table.AsEnumerable() Select row("Crop") From what I understand, the "f_table.AsEnumerable" should make my search object ("row" in this case) a datarow object. This simple example runs without any…
user3496060
  • 800
  • 10
  • 20
1
vote
1 answer

Reference DataTable columns with Linq

I am trying to join two datatables using linq var invoices420 = dt420_.AsEnumerable(); var invoices430 = dt430_.AsEnumerable(); var query = from inv430 in invoices430 join inv420 in invoices420 on inv430.LinkDoc…
mko
  • 6,638
  • 12
  • 67
  • 118
1
vote
2 answers

What is the effect of using AsEnumerable() on paging?

I understand that if you have some function in a linq query that does not map to a sql query then you must call .AsEnumerable() first: var model = _service.GetQuery .Where(data => data.SomeFlag == true) …
JK.
  • 21,477
  • 35
  • 135
  • 214
0
votes
2 answers

Significance of AsEnumerable?

var query = from dt1 in dtStudent.AsEnumerable() join dt2 in dtMarks.AsEnumerable() on dt1.Field("StudentID") equals dt2.Field("StudentID") select new StudentMark { StudentName =…
Prem
  • 5,685
  • 15
  • 52
  • 95
0
votes
1 answer

How to Get Single Column Value in c# LINQ?

DataTable Master_Table = Execute_Manager.getTableDataSet(connection, select_query, master_table); string RuleName = (From EachRow in Master_Table where EachRow.Field("RuleID") == "123456" Select…
0
votes
0 answers

How to change the format "N2" from DataTable and Show in DataGridView in vb.net

How to change the DataTable format to "N2" and Show in DataGridView in vb.net?. I want to change the format of the DataTable without going through the DataGridView format and displaying in the DataGridView. Please recommend the best solution. I…
roy
  • 693
  • 2
  • 11
1
2 3