Solved

SQL Query into LINQ (DATENAME)

Posted on 2009-05-07
4
887 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:Dishan Fernando
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Dishan Fernando
ID: 24324320
I Think, DATENAME function not supported by LINQ
0
 
LVL 8

Author Comment

by:Dishan Fernando
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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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