Click here to Skip to main content
15,890,282 members
Home / Discussions / C#
   

C#

 
GeneralRe: Search in SQL tables using c# Pin
Wannabe Pro25-Feb-15 8:09
Wannabe Pro25-Feb-15 8:09 
QuestionHow do I make a MVC project appear properly in Visual Studio? Pin
Xarzu20-Feb-15 6:16
Xarzu20-Feb-15 6:16 
AnswerRe: How do I make a MVC project appear properly in Visual Studio? Pin
BillWoodruff20-Feb-15 12:43
professionalBillWoodruff20-Feb-15 12:43 
AnswerRe: How do I make a MVC project appear properly in Visual Studio? Pin
Gerry Schmitz20-Feb-15 12:47
mveGerry Schmitz20-Feb-15 12:47 
AnswerRe: How do I make a MVC project appear properly in Visual Studio? Pin
Afzaal Ahmad Zeeshan20-Feb-15 22:22
professionalAfzaal Ahmad Zeeshan20-Feb-15 22:22 
AnswerRe: How do I make a MVC project appear properly in Visual Studio? Pin
Simon_Whale23-Feb-15 5:53
Simon_Whale23-Feb-15 5:53 
Questionhow do i cut an image of an convex hull? Pin
neodeaths20-Feb-15 5:47
neodeaths20-Feb-15 5:47 
QuestionLinq Query : Translate Local Variables reference Pin
dilkonika19-Feb-15 13:50
dilkonika19-Feb-15 13:50 
Hello !
I'm using the information from this MSDN blog :
http://blogs.msdn.com/b/mattwar/archive/2007/08/01/linq-building-an-iqueryable-provider-part-iii.aspx[^]
to translate local variable references in linq queries.
Everything works very well except the case when I have a DateTime variable inside the query that I have to translate .

This is my case :

On my database I have the table orders where dt column have Date Type and store only the date.

Now if I have this query :
DateTime dt1 = Convert.ToDateTime("01/01/2012");
    var query = db.Orders.Where(c => c.dt == dt1);

If I try to translate , the returned expression is :
SQL
SELECT * FROM (SELECT * FROM Orders) AS T WHERE (dt = '01/01/2012 12:00:00
AM')

As you can see the translated query contains the time at the end , and my query everytime return no records.

What can I do that in translated query the value to be only the date without the time.?

I try many variants , I format the variable only to date format , but it's the same thing.

Thank you !
AnswerRe: Linq Query : Translate Local Variables reference Pin
Gerry Schmitz19-Feb-15 17:40
mveGerry Schmitz19-Feb-15 17:40 
GeneralRe: Linq Query : Translate Local Variables reference Pin
dilkonika19-Feb-15 17:54
dilkonika19-Feb-15 17:54 
GeneralRe: Linq Query : Translate Local Variables reference Pin
Gerry Schmitz19-Feb-15 19:05
mveGerry Schmitz19-Feb-15 19:05 
AnswerRe: Linq Query : Translate Local Variables reference Pin
Eddy Vluggen20-Feb-15 1:18
professionalEddy Vluggen20-Feb-15 1:18 
AnswerRe: Linq Query : Translate Local Variables reference Pin
HKHerron20-Feb-15 7:12
professionalHKHerron20-Feb-15 7:12 
Questionc# "Object reference not set to an instance of an object." Pin
iguru119-Feb-15 11:53
iguru119-Feb-15 11:53 
AnswerRe: c# "Object reference not set to an instance of an object." Pin
Ron Nicholson19-Feb-15 12:11
professionalRon Nicholson19-Feb-15 12:11 
AnswerRe: c# "Object reference not set to an instance of an object." Pin
V.19-Feb-15 20:34
professionalV.19-Feb-15 20:34 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
Richard MacCutchan19-Feb-15 21:25
mveRichard MacCutchan19-Feb-15 21:25 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
V.19-Feb-15 21:28
professionalV.19-Feb-15 21:28 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
Richard MacCutchan19-Feb-15 21:40
mveRichard MacCutchan19-Feb-15 21:40 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
V.19-Feb-15 21:46
professionalV.19-Feb-15 21:46 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
Richard MacCutchan19-Feb-15 22:11
mveRichard MacCutchan19-Feb-15 22:11 
SuggestionRe: c# "Object reference not set to an instance of an object." Pin
V.19-Feb-15 22:19
professionalV.19-Feb-15 22:19 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
Eddy Vluggen19-Feb-15 22:29
professionalEddy Vluggen19-Feb-15 22:29 
GeneralRe: c# "Object reference not set to an instance of an object." Pin
V.19-Feb-15 22:39
professionalV.19-Feb-15 22:39 
AnswerRe: c# "Object reference not set to an instance of an object." Pin
mikhail cabliao20-Feb-15 7:25
mikhail cabliao20-Feb-15 7:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.