Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
QuestionThere is already an open DataReader associated with this Command which must be closed first. Pin
govind_nanna5-Dec-18 19:45
govind_nanna5-Dec-18 19:45 
AnswerRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Pete O'Hanlon5-Dec-18 20:54
mvePete O'Hanlon5-Dec-18 20:54 
AnswerRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff5-Dec-18 21:30
mveOriginalGriff5-Dec-18 21:30 
JokeRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Richard Deeming6-Dec-18 8:01
mveRichard Deeming6-Dec-18 8:01 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff6-Dec-18 20:44
mveOriginalGriff6-Dec-18 20:44 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Richard MacCutchan6-Dec-18 23:21
mveRichard MacCutchan6-Dec-18 23:21 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff6-Dec-18 23:31
mveOriginalGriff6-Dec-18 23:31 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Pete O'Hanlon7-Dec-18 1:17
mvePete O'Hanlon7-Dec-18 1:17 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff7-Dec-18 1:40
mveOriginalGriff7-Dec-18 1:40 
QuestionDynamic alignment of winform controls Pin
george49864-Dec-18 17:52
professionalgeorge49864-Dec-18 17:52 
AnswerRe: Dynamic alignment of winform controls Pin
Dave Kreskowiak4-Dec-18 17:56
mveDave Kreskowiak4-Dec-18 17:56 
GeneralRe: Dynamic alignment of winform controls Pin
george49864-Dec-18 18:38
professionalgeorge49864-Dec-18 18:38 
AnswerRe: Dynamic alignment of winform controls Pin
Eddy Vluggen5-Dec-18 2:03
professionalEddy Vluggen5-Dec-18 2:03 
AnswerRe: Dynamic alignment of winform controls Pin
BillWoodruff5-Dec-18 14:44
professionalBillWoodruff5-Dec-18 14:44 
QuestionReflection - from Type to Class (not instance of class) Pin
devvvy4-Dec-18 13:51
devvvy4-Dec-18 13:51 
AnswerRe: Reflection - from Type to Class (not instance of class) Pin
OriginalGriff4-Dec-18 21:31
mveOriginalGriff4-Dec-18 21:31 
AnswerRe: Reflection - from Type to Class (not instance of class) Pin
F-ES Sitecore5-Dec-18 1:02
professionalF-ES Sitecore5-Dec-18 1:02 
AnswerRe: Reflection - from Type to Class (not instance of class) Pin
Richard Deeming5-Dec-18 9:09
mveRichard Deeming5-Dec-18 9:09 
QuestionCode refactoring.. Pin
Simon_Whale4-Dec-18 2:49
Simon_Whale4-Dec-18 2:49 
AnswerRe: Code refactoring.. Pin
dan!sh 4-Dec-18 3:29
professional dan!sh 4-Dec-18 3:29 
AnswerRe: Code refactoring.. Pin
Gerry Schmitz4-Dec-18 8:06
mveGerry Schmitz4-Dec-18 8:06 
AnswerRe: Code refactoring.. Pin
Luc Pattyn4-Dec-18 21:53
sitebuilderLuc Pattyn4-Dec-18 21:53 
Hi,

as others already noted, every second call to MethodCall(param1, param2, param3), I mean the ones after the question marks, is likely to return true, as you just have tested for true (that is what the question mark does). I say likely, it might be ugly code that creates or uses nasty side effects. If so, what follows needs some adjusting.

it seems all your params have the same type, and all your someIntValues have different values, so I would suggest you:

1. stuff all the params in an array "paramsArray"
2. stuff all the someIntValues in an array "someIntValuesArray"
3. modify your MethodCall() to accept paramsArray and return an integer, being the first index in the paramsArray for which the original MethodCall() did return true; this basically means surrounding existing code with a for loop, adjusting the params (now array elements); also return a special value if no match found, say -1.
4. then simply do
int index=MethodCall(paramsArray);
if (index>=0) outcome=AnotherMethod(true, someIntValuesArray[index]);


Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

QuestionRdlc reporting page break doesnt work- URGENT Pin
Member 132642683-Dec-18 18:40
Member 132642683-Dec-18 18:40 
AnswerRe: Rdlc reporting page break doesnt work- URGENT Pin
Richard MacCutchan3-Dec-18 21:56
mveRichard MacCutchan3-Dec-18 21:56 
AnswerRe: Rdlc reporting page break doesnt work- URGENT Pin
OriginalGriff3-Dec-18 22:16
mveOriginalGriff3-Dec-18 22:16 

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.