Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 915
  • Last Modified:

SQL Query into LINQ (DATENAME)

Hi Experts,
Is there any equivalent LINQ query for this SQL?
 
SELECT DATENAME(mm,Date), DATENAME(dw,Date)
FROM Order

Thanks
Dishan

0
Dishan Fernando
Asked:
Dishan Fernando
  • 2
  • 2
1 Solution
 
reb73Commented:
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
 
Dishan FernandoSoftware Engineer / DBAAuthor Commented:
I Think, DATENAME function not supported by LINQ
0
 
Dishan FernandoSoftware Engineer / DBAAuthor Commented:
Hi reb73, This doesn't work.
0
 
reb73Commented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now