Click here to Skip to main content
16,004,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: xml Document Pin
arkiboys12-Oct-09 13:52
arkiboys12-Oct-09 13:52 
GeneralRe: xml Document Pin
Luc Pattyn12-Oct-09 14:04
sitebuilderLuc Pattyn12-Oct-09 14:04 
GeneralRe: xml Document Pin
arkiboys12-Oct-09 14:07
arkiboys12-Oct-09 14:07 
GeneralRe: xml Document Pin
Not Active12-Oct-09 15:26
mentorNot Active12-Oct-09 15:26 
GeneralRe: xml Document Pin
arkiboys12-Oct-09 19:55
arkiboys12-Oct-09 19:55 
QuestionLearning foreach... Pin
JollyMansArt12-Oct-09 13:12
JollyMansArt12-Oct-09 13:12 
AnswerRe: Learning foreach... Pin
Luc Pattyn12-Oct-09 13:37
sitebuilderLuc Pattyn12-Oct-09 13:37 
AnswerRe: Learning foreach... Pin
OriginalGriff12-Oct-09 22:20
mveOriginalGriff12-Oct-09 22:20 
JollyMansArt wrote:
1) How would you say:
foreach(table in database)

then how would you say
foreach(row in table)


foreach is not a realy usable construct for examining database tables, I would normally use
reader = sqlCmd.ExecuteReader();
while (reader.Read())
    {
    ...
    }

Think about it: if you were dealing with a file, you would say:
string[] lines = inFile.ReadAllLines();
foreach(string s in lines)
   {
   ...
   }

rather than trying:
foreach(LineOfText line in inFile)
   {
   ...
   }


You can't use foreach for the columns, either - there isn't an Items collection - but even if you could, it really wouldn't be too helpfull:
foreach(var v in reader.Items)
   {
   ... Workout what type it is and what to do with it...
   }


No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

QuestiondataGridView and dataView Pin
mahraja12-Oct-09 12:51
mahraja12-Oct-09 12:51 
Questionxml Pin
arkiboys12-Oct-09 11:25
arkiboys12-Oct-09 11:25 
AnswerRe: xml Pin
Henry Minute12-Oct-09 12:05
Henry Minute12-Oct-09 12:05 
AnswerRe: xml Pin
DaveyM6912-Oct-09 12:24
professionalDaveyM6912-Oct-09 12:24 
GeneralRe: xml Pin
arkiboys12-Oct-09 12:47
arkiboys12-Oct-09 12:47 
GeneralRe: xml Pin
Not Active12-Oct-09 12:53
mentorNot Active12-Oct-09 12:53 
GeneralRe: xml Pin
arkiboys12-Oct-09 12:55
arkiboys12-Oct-09 12:55 
GeneralRe: xml Pin
DaveyM6912-Oct-09 13:06
professionalDaveyM6912-Oct-09 13:06 
GeneralRe: xml Pin
Not Active12-Oct-09 13:42
mentorNot Active12-Oct-09 13:42 
GeneralRe: xml Pin
Henry Minute12-Oct-09 13:02
Henry Minute12-Oct-09 13:02 
GeneralRe: xml Pin
arkiboys12-Oct-09 13:25
arkiboys12-Oct-09 13:25 
GeneralRe: xml Pin
Henry Minute13-Oct-09 0:40
Henry Minute13-Oct-09 0:40 
GeneralRe: xml Pin
arkiboys13-Oct-09 11:54
arkiboys13-Oct-09 11:54 
GeneralRe: xml Pin
DaveyM6912-Oct-09 13:26
professionalDaveyM6912-Oct-09 13:26 
GeneralRe: xml Pin
Not Active12-Oct-09 13:40
mentorNot Active12-Oct-09 13:40 
GeneralRe: xml Pin
Henry Minute13-Oct-09 0:26
Henry Minute13-Oct-09 0:26 
AnswerRe: xml Pin
PIEBALDconsult12-Oct-09 13:28
mvePIEBALDconsult12-Oct-09 13:28 

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.