Not considering "If condition in inside the foreach statement" [modified]
-
Hi my code not at all considering the if condition: Plz whats wrong in that code tell me..., foreach (DataRow drc in DS.Tables[DS.Tables.Count - 1].Rows) { int k = 0; while (k < drc.Table.Rows.Count) { if (drc.Table.Rows[k][1].ToString() == Path.GetFileNameWithoutExtension(d.Name)) { if (mbody.Length > 0) { mbody += ", "; } mbody += drc.Table.Rows[k][1].ToString(); } k++; } }
Thanks & Regards, NeW OnE, please don't forget to vote on the post
modified on Monday, July 28, 2008 6:32 AM
-
Hi my code not at all considering the if condition: Plz whats wrong in that code tell me..., foreach (DataRow drc in DS.Tables[DS.Tables.Count - 1].Rows) { int k = 0; while (k < drc.Table.Rows.Count) { if (drc.Table.Rows[k][1].ToString() == Path.GetFileNameWithoutExtension(d.Name)) { if (mbody.Length > 0) { mbody += ", "; } mbody += drc.Table.Rows[k][1].ToString(); } k++; } }
Thanks & Regards, NeW OnE, please don't forget to vote on the post
modified on Monday, July 28, 2008 6:32 AM
-
this
if (drc.Table.Rows[k][1].ToString() == Path.GetFileNameWithoutExtension(d.Name))
is always false? Orif (mbody.Length > 0)
return always 0 (zero) length ?
I Love T-SQL "Don't torture yourself,let the life to do it for you."
hi sir plz tell us why it will give false and 0 lenth always? thanks.... gaurav
-
Hi my code not at all considering the if condition: Plz whats wrong in that code tell me..., foreach (DataRow drc in DS.Tables[DS.Tables.Count - 1].Rows) { int k = 0; while (k < drc.Table.Rows.Count) { if (drc.Table.Rows[k][1].ToString() == Path.GetFileNameWithoutExtension(d.Name)) { if (mbody.Length > 0) { mbody += ", "; } mbody += drc.Table.Rows[k][1].ToString(); } k++; } }
Thanks & Regards, NeW OnE, please don't forget to vote on the post
modified on Monday, July 28, 2008 6:32 AM
New one wrote:
DS.Tables[DS.Tables.Count - 1].Rows
If there is only one Table in the DS always, Why cant you use a DataTable.
New one wrote:
drc.Table.Rows[k][1].ToString()
Set a break point a check what value is there in the above code.
-
hi sir plz tell us why it will give false and 0 lenth always? thanks.... gaurav