Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
AnswerRe: What is best way to declare constants set? Pin
PIEBALDconsult28-Jul-11 2:51
mvePIEBALDconsult28-Jul-11 2:51 
AnswerRe: What is best way to declare constants set? Pin
Eddy Vluggen28-Jul-11 6:52
professionalEddy Vluggen28-Jul-11 6:52 
AnswerRe: What is best way to declare constants set? Pin
RobCroll28-Jul-11 13:53
RobCroll28-Jul-11 13:53 
AnswerRe: What is best way to declare constants set? Pin
BillWoodruff28-Jul-11 18:09
professionalBillWoodruff28-Jul-11 18:09 
GeneralRe: What is best way to declare constants set? Pin
PIEBALDconsult29-Jul-11 3:01
mvePIEBALDconsult29-Jul-11 3:01 
AnswerRe: What is best way to declare constants set? Pin
BobJanova29-Jul-11 5:31
BobJanova29-Jul-11 5:31 
QuestionC# and SQL Server :: Find Most Common Via Junction Table Pin
Matt U.27-Jul-11 14:25
Matt U.27-Jul-11 14:25 
AnswerRe: C# and SQL Server :: Find Most Common Via Junction Table Pin
Łukasz Nowakowski27-Jul-11 23:28
Łukasz Nowakowski27-Jul-11 23:28 
I don't know if I understand correctly your issue. I understand the issue is, that you have tables:
1. [Repaired item] ([Serial Number], [Some data about item]) - stores information about items, that are repaired (car, or whatever).
2. [Failure Codes] ([Failure Code], [Information about failure]) - stores information about failures, that can be repaired.
3. [Repair Data] ([Serial Number], [Failure Code]) - stores connection between [Repaired item] and [Failure Codes].

With the structure above you want (for the given [Serial Number]) find the failure that occurs most often.
If the above is correct, then I think you should do this in SQL using the following query:
SELECT
    [Serial Number],
    [Failure Code],
    COUNT(*) AS [Counter]
    FROM
        [Failure Codes]
    WHERE
        [Serial Number] = @SerialNumber
    GROUP BY
        [Serial Number],
        [Failure Code]
    ORDER BY
        [Counter] ASC

And you can retrieve it easily from C# without any loops.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.

QuestionHow to close a file? Pin
Member 806979527-Jul-11 8:09
Member 806979527-Jul-11 8:09 
AnswerRe: How to close a file? Pin
Ennis Ray Lynch, Jr.27-Jul-11 9:07
Ennis Ray Lynch, Jr.27-Jul-11 9:07 
AnswerRe: How to close a file? Pin
PIEBALDconsult27-Jul-11 14:44
mvePIEBALDconsult27-Jul-11 14:44 
GeneralRe: How to close a file? Pin
Member 806979529-Jul-11 4:29
Member 806979529-Jul-11 4:29 
GeneralRe: How to close a file? Pin
PIEBALDconsult30-Jul-11 5:18
mvePIEBALDconsult30-Jul-11 5:18 
AnswerRe: How to close a file? Pin
jjdacl28-Jul-11 16:46
jjdacl28-Jul-11 16:46 
QuestionDbDataReader: Matching fields to order or occurrence? Pin
Goalie3527-Jul-11 4:14
Goalie3527-Jul-11 4:14 
AnswerRe: DbDataReader: Matching fields to order or occurrence? Pin
dasblinkenlight27-Jul-11 4:26
dasblinkenlight27-Jul-11 4:26 
AnswerRe: DbDataReader: Matching fields to order or occurrence? Pin
Ennis Ray Lynch, Jr.27-Jul-11 5:41
Ennis Ray Lynch, Jr.27-Jul-11 5:41 
AnswerRe: DbDataReader: Matching fields to order or occurrence? Pin
PIEBALDconsult27-Jul-11 14:45
mvePIEBALDconsult27-Jul-11 14:45 
AnswerRe: DbDataReader: Matching fields to order or occurrence? Pin
Eddy Vluggen28-Jul-11 9:49
professionalEddy Vluggen28-Jul-11 9:49 
GeneralRe: DbDataReader: Matching fields to order or occurrence? Pin
PIEBALDconsult28-Jul-11 13:57
mvePIEBALDconsult28-Jul-11 13:57 
Questiondeveloping program Pin
albertodiprima27-Jul-11 4:08
albertodiprima27-Jul-11 4:08 
AnswerRe: developing program Pin
Richard MacCutchan27-Jul-11 4:12
mveRichard MacCutchan27-Jul-11 4:12 
GeneralRe: developing program Pin
albertodiprima27-Jul-11 4:17
albertodiprima27-Jul-11 4:17 
GeneralRe: developing program Pin
Blue_Boy27-Jul-11 4:37
Blue_Boy27-Jul-11 4:37 
QuestionLoading of pictures and (un)covering them Pin
nstk27-Jul-11 0:02
nstk27-Jul-11 0:02 

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.