linq

How to enumerate Linq results?

Referring to this topic: http://stackoverflow.com/questions/4038836/minimize-linq-string-token-counter And using the following provided code: string src = "for each character in the string, take the rest of the " + "string starting from that character " + "as a substring; count it if it starts with the target s...

BETWEEN EQUIVALENT in LINQ

Hi: I am looking LINQ equivalent for the following query Select * from ct_rate WHERE '2010-10-01 00:00:00' BETWEEN start_date and end_date; ANY IDEA? Thanks in Advance ...

Ccross table / object update with (Db)LINQ

Hi, I wonder if someone can help me out translating a MySQL query to (Db)LINQ statement. I’ve made a test case for what I want to do, so data and structure are different than what I really want to do, but it’s just meant to get it working. In a MySQL database I have this table: CREATE TABLE `mytable1` ( `id` int(11) NOT NUL...

nhibernate linq and let keyword

Is this possible to use let keyword with nhibernate linq? I wrote posts = from post in postsRepository.GetPosts(name) let commentsCount = (from c in NHUnitOfWork.CurrentSession.Linq<Comment>() where c.Post.ID == post.ID select c).Count() select new ... and in r...

Can I using LINQ return a List<Person> from a List<String>

Can I using LINQ return a List<Person> from a List<String> like the following: // this is not valid code, just to explain the idea var persons = new string[] {"Tom", "Adam"}.ToList<Person>(str => Name = str); Thanks in advance. ...

Linq Help Me plz

[ExcelSheet(Name = "A", Sn = "A")] public class A : System.ComponentModel.INotifyPropertyChanged { public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; public virtual void SendPropertyChanged(string propertyName) { System.ComponentModel.PropertyChangedEventHandler handler = PropertyChanged...

question about linq select and ToList()

I have a problem with returning a list by executing a Select LINQ query. This is the query: var data = Repository<EducationString> .Find() .ToList() .Select(p => new EducationStringModel() { Id = p.Id, Title = p.Title, Education...

Linq to SQL Sum()

select sum(Sales) from WeeklyProductSale. how i can write this query in linq and what this query will return to me. thankas in advance. ...

login form using LINQ ?

Hi ! I need help . I need a login form (user/pass) using LINQ, .net3.5, C# I need a sample code for this. Its urgent ...suggest how can i do it ASAP . any open project from where i can take the login part ? any code you dont mind sharing ?!! thanks sj ...

Where is SyncLinq??

In 2007 Paul stovell created this set of extentions. It notifies the UI of changes. It seems to have disappeared. What can we use today that mimcs its functionality??? ...

LNQ to XML. Enumeration yielded no results?

Hello all, i cannot figure out why Enumeration does not yield any results Dim Configuration = From Setup In XElement.Load("C:\xml\setup.xml").Elements("settings") Select Setup For Each Setting As String In Configuration 'Do something Next And here is the Xml file located at C:/xml/setup.xml <?xml vers...

Running different code depending on what Net Framework version is installed

Suppose I have a LINQ method that I wanted to run using normal LINQ if the Net Framework 3.5 is installed, but using PLINQ if 4.0 or higher is installed. Is this possible ? ...

Linq to SQL intellisense has no knowledge of tables within the datacontext object.

I can successfully connect to the database with my datacontext object. I am able to read and write to the database successfully, however I can't use the same syntax that others appear to be using. For example, when I want data from a table, I have to do something like this: db = new UserDataDataContext(WebConfigurationManager.Connecti...

does converting iqueryable to ienumerable execute the query again?

in my query i need to return ienumerable but i dont know if this action make the query to execute again? var data=Repository.Find().AsEnumerable(); find() returns iqueryable and because iqueryable inherits ienumerable i doubt if AsEnumerable make the repeatetive execution. i know that var data=Repository.Find().ToList() make executes...

object collections with linq

What are the different collections available to store objects and which one's best to use when? IList, IEnumerate, IQueryable... I'm new to .net Thanks. ...

Is it true that writing LINQ queries is not easy for complex queries?

Is it true that writing LINQ queries is not easy for complex queries? select a.sNavID, a.sNavText, a.sNavText as EName, ' '+a.sNavText as NameDisplay from ContentPageNav as a where a.navID=0 union select b.sNavID, a.sNavText + ' >> ' + b.sNavText as Name, b.sNavText as EName, ' ' + b.sNavTex...

All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.

All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists. why do i get this error? ...

Nested Linq performance

We have 2 tables (tblSerials and tblRequests). The question is how can we make this code to execute faster? As you can see "from request in ctx.tblRequests" parts are very similar. Any other better solution? var list = from s in ctx.tblSerials orderby s.CreateDate descending select new { SerialGUID = s.S...