Click here to Skip to main content
       

ASP.NET

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionSQL query in c#memberAnirbanM 23 Dec '12 - 2:31 
I'm having one web application where within loop I'm running one simple sql query (SQL Server 2008).
Select SNo, NoOfDays, [Month], [Year], [Days], [Holiday] From DaysMonth Where rtrim(Period)='Input' order by ToDate
Based on this query, populating one gridview and then creating records in a new table with other user input.
Now, out of 100 times it's running, 95-98 times it's giving accurate results, however, to my astonishment, sometimes sorting 'Order by' not working and producing abnormal sorting behavior. Like instead of 1st January to 31 January, it's returning 10th Jan-31st Jan then 1st Jan to 9th Jan (just for example). I got puzzled, because I can't do anything to change code, as it's working fine most of the time. Can you suggest some reason behind it which is beyond the code. As the data entry is huge, and it's multi-user environment, getting very difficult to monitor which one query going wrong. In that case, if I delete entries from new table, second time, it's giving perfect result. Please help me and thanks in advance to all.
AnswerRe: SQL query in c#mvpRichard MacCutchan3 Dec '12 - 2:36 
You already posted this in the C# forum, which is also not the correct place. This is a Database query and belongs in that forum.
One of these days I'm going to think of a really clever signature.

GeneralRe: SQL query in c#memberAnirbanM 23 Dec '12 - 2:47 
Richard, I already deleted this question from C# forum. As you are suggesting, I think this is not related to SQL Server and it's muti-user web environment state management related problem. Anyway, if you think so, can I keep this question under this category and create a new thread in Database forum? Thanks for your suggestion.
GeneralRe: SQL query in c#mvpRichard MacCutchan3 Dec '12 - 2:50 
Even if it was related to SQL Server, it has nothing to do with either C# or ASP.NET. It's pure SQL and you need to give some more information about the field you are using to sort on: i.e. its type and value.
One of these days I'm going to think of a really clever signature.

GeneralRe: SQL query in c#memberAnirbanM 23 Dec '12 - 2:56 
okay agreed. So I'll delete it from here and create under SQL. However, just to answer your query, 'ToDate' field is a 'Date' type field, not DateTime type. User input Period is a varchar type field, input value like 'January,2012'. Thanks

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


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 24 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid