Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 10, 2012 02:15 PM by justin9
Member
67 Points
123 Posts
Aug 03, 2012 08:47 PM|LINK
Hi
I have the following for each loop
DataRow[] drGrants = ds.Tables[3].Select("EMP_NUMBER = '" + EMPnumber +"'"); foreach (DataRow drgrants in drGrants) { CODE...! }
the loop is getting the input from empnumber, then it goes to drGrants and then it go out of the loop.
is there something wrong with my code - Please Advise.
thanks,
Justin.
Star
12358 Points
2274 Posts
Aug 03, 2012 09:01 PM|LINK
What's the error?
Participant
1883 Points
323 Posts
Aug 03, 2012 11:55 PM|LINK
Hi, friend
please explain your problem clearly to enable us help you
All-Star
95503 Points
14106 Posts
Aug 04, 2012 09:01 AM|LINK
you need to use AsEnumerable()....so ds.Tables[3].AsEnumaerable().Select....
Thanks,
Aug 06, 2012 03:34 PM|LINK
Hi im not getting an error but the , its goin out of the loop. i check the stored proc which is showing the data but for some reason its not looping.
Contributor
5131 Points
827 Posts
Aug 06, 2012 03:42 PM|LINK
Try this
DataRow[] drGrants = from myRow in ds.Tables[3].AsEnumerable() where myRow.Field<String>("EMP_NUMBER") == EMPnumber select myRow; foreach (DataRow drgrants in drGrants) { }
Aug 10, 2012 02:15 PM|LINK
Hi All i found ther error - there was a mistake in the stored proc sent by the DAB which was only select the tope 50 rows.
thanks for all your help.
justin9
Member
67 Points
123 Posts
For each loop error
Aug 03, 2012 08:47 PM|LINK
Hi
I have the following for each loop
DataRow[] drGrants = ds.Tables[3].Select("EMP_NUMBER = '" + EMPnumber +"'"); foreach (DataRow drgrants in drGrants) { CODE...! }the loop is getting the input from empnumber, then it goes to drGrants and then it go out of the loop.
is there something wrong with my code - Please Advise.
thanks,
Justin.
AceCorban
Star
12358 Points
2274 Posts
Re: For each loop error
Aug 03, 2012 09:01 PM|LINK
What's the error?
Damn Code
Participant
1883 Points
323 Posts
Re: For each loop error
Aug 03, 2012 11:55 PM|LINK
Hi, friend
please explain your problem clearly to enable us help you
Please remember to Mark the replies as Answers if they help & unmark them if they provide no help.
ramiramilu
All-Star
95503 Points
14106 Posts
Re: For each loop error
Aug 04, 2012 09:01 AM|LINK
you need to use AsEnumerable()....so ds.Tables[3].AsEnumaerable().Select....
Thanks,
JumpStart
justin9
Member
67 Points
123 Posts
Re: For each loop error
Aug 06, 2012 03:34 PM|LINK
Hi im not getting an error but the , its goin out of the loop. i check the stored proc which is showing the data but for some reason its not looping.
Ramesh T
Contributor
5131 Points
827 Posts
Re: For each loop error
Aug 06, 2012 03:42 PM|LINK
Try this
DataRow[] drGrants = from myRow in ds.Tables[3].AsEnumerable() where myRow.Field<String>("EMP_NUMBER") == EMPnumber select myRow; foreach (DataRow drgrants in drGrants) { }justin9
Member
67 Points
123 Posts
Re: For each loop error
Aug 10, 2012 02:15 PM|LINK
Hi All i found ther error - there was a mistake in the stored proc sent by the DAB which was only select the tope 50 rows.
thanks for all your help.