Solved

SQL Query into LINQ (DATENAME)

Posted on 2009-05-07
4
865 Views
Last Modified: 2013-11-26
Hi Experts,
Is there any equivalent LINQ query for this SQL?
 
SELECT DATENAME(mm,Date), DATENAME(dw,Date)
FROM Order

Thanks
Dishan

0
Comment
Question by:dishanf
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:reb73
ID: 24323941
Not 100% sure if this'll work, but something like this should do it -


Dim query = From o In Order _
            Select  MonthName = o.Date.Value.ToString("MMM") _
		,WeekDayName  = o.Date.Value.DayOfWeek.ToString()

Open in new window

0
 
LVL 8

Author Comment

by:dishanf
ID: 24324320
I Think, DATENAME function not supported by LINQ
0
 
LVL 8

Author Comment

by:dishanf
ID: 24324353
Hi reb73, This doesn't work.
0
 
LVL 25

Accepted Solution

by:
reb73 earned 125 total points
ID: 24324405
No, not the DATENAME function as such is not supported by LINQ language reference, but you should be able to apply VB.NET/C# functions to returned values..
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now