Click here to Skip to main content
15,892,575 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to exit a while loop inside of a while loop Pin
Abhijit Jana16-Nov-09 17:18
professionalAbhijit Jana16-Nov-09 17:18 
AnswerRe: How to exit a while loop inside of a while loop Pin
Shameel16-Nov-09 22:49
professionalShameel16-Nov-09 22:49 
GeneralRe: How to exit a while loop inside of a while loop Pin
Luc Pattyn17-Nov-09 1:28
sitebuilderLuc Pattyn17-Nov-09 1:28 
GeneralRe: How to exit a while loop inside of a while loop Pin
Shameel17-Nov-09 3:15
professionalShameel17-Nov-09 3:15 
GeneralRe: How to exit a while loop inside of a while loop Pin
Luc Pattyn17-Nov-09 3:33
sitebuilderLuc Pattyn17-Nov-09 3:33 
GeneralRe: How to exit a while loop inside of a while loop Pin
Shameel17-Nov-09 7:53
professionalShameel17-Nov-09 7:53 
AnswerRe: How to exit a while loop inside of a while loop Pin
Drew Stainton21-Nov-09 3:46
Drew Stainton21-Nov-09 3:46 
QuestionHow to exit a while loop inside of a while loop Pin
TheJudeDude16-Nov-09 16:07
TheJudeDude16-Nov-09 16:07 
For all, this is a question on the best/most elegant way to do this.

I am reading records from a database. I start the read with a database reader.ExecuteReader() method. Then I put a while Reader.read() statement to start the loop. While within this loop, I have to add up figures for certain records (store numbers). For this I use another while loop (while store number == store number). Within this while loop, I advance the records read with another reader.read() method.
The problem with this is that when it reaches the last record, the test for store number is not valid because the next record is null.

I called over my colleague to help me out with this problem, and he suggested a break on an if (!dbreader.read()). I thought this was a dirty way to get our of this, but it works!

I know I have not supplied code, but I hope you all can see it the way I explained it (this code is on a virtual machine that I do not have remote access to at the moment), But if needed I will provide.

The end question is, is it ok to use break? How often is it really used? I have always been taught not to use break/goto/gosub in C# and I just thought I would get some input here.

Thanx in advance!

Jude

AnswerRe: How to exit a while loop inside of a while loop Pin
Jaime Olivares16-Nov-09 16:38
Jaime Olivares16-Nov-09 16:38 
AnswerRe: How to exit a while loop inside of a while loop Pin
Jaime Olivares16-Nov-09 16:39
Jaime Olivares16-Nov-09 16:39 
GeneralRe: How to exit a while loop inside of a while loop Pin
TheJudeDude16-Nov-09 17:54
TheJudeDude16-Nov-09 17:54 
QuestionZoom Desktop like Windows 7 Magnifier? Pin
FocusedWolf16-Nov-09 15:43
FocusedWolf16-Nov-09 15:43 
AnswerRe: Zoom Desktop like Windows 7 Magnifier? Pin
Jaime Olivares16-Nov-09 16:30
Jaime Olivares16-Nov-09 16:30 
GeneralRe: Zoom Desktop like Windows 7 Magnifier? Pin
Jaime Olivares16-Nov-09 16:33
Jaime Olivares16-Nov-09 16:33 
GeneralRe: Zoom Desktop like Windows 7 Magnifier? Pin
FocusedWolf17-Nov-09 11:42
FocusedWolf17-Nov-09 11:42 
QuestionWebBrowser control without Form hosting Pin
csmanul16-Nov-09 15:26
csmanul16-Nov-09 15:26 
AnswerRe: WebBrowser control without Form hosting Pin
Luc Pattyn16-Nov-09 15:37
sitebuilderLuc Pattyn16-Nov-09 15:37 
GeneralRe: WebBrowser control without Form hosting Pin
csmanul17-Nov-09 1:28
csmanul17-Nov-09 1:28 
GeneralRe: WebBrowser control without Form hosting Pin
Luc Pattyn17-Nov-09 2:06
sitebuilderLuc Pattyn17-Nov-09 2:06 
AnswerRe: WebBrowser control without Form hosting Pin
Shameel16-Nov-09 22:54
professionalShameel16-Nov-09 22:54 
GeneralRe: WebBrowser control without Form hosting Pin
csmanul17-Nov-09 1:21
csmanul17-Nov-09 1:21 
GeneralRe: WebBrowser control without Form hosting Pin
Shameel17-Nov-09 3:19
professionalShameel17-Nov-09 3:19 
GeneralRe: WebBrowser control without Form hosting Pin
Shameel17-Nov-09 3:26
professionalShameel17-Nov-09 3:26 
QuestionGetting a console server to do more then connect Pin
bigjoe11a16-Nov-09 15:22
bigjoe11a16-Nov-09 15:22 
AnswerRe: Getting a console server to do more then connect Pin
ScottM116-Nov-09 19:03
ScottM116-Nov-09 19:03 

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.