Solved

SQL Query into LINQ (DATENAME)

Posted on 2009-05-07
4
859 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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