tags:

views:

107

answers:

1

How to convert convert(varchar,datefield,106) of SQL's in LINQ?

Thanks in advance

+3  A: 

You can get a string representation of a date by using ToString()

myDate.ToString()

and a date representation of a string by parsing it.

DateTime.Parse(myDateString)

You just need to include your conversion in your select clause.

from myRecord in myDataContext.MyTable
     select new {myStringDate = myRecord.myDate.ToString()};
Robert Harvey