By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

Checking for last row in a datarow

P: n/a
Hi everyone,

I like add \r\n to all my rows except for the last row. How do I check
for the last in the following code?

StringBuilder sb = new StringBuilder();
foreach (DataRow row in rows)
{
sb.Append(row["Mesg"].ToString());

if (??????????????????) {
sb.Append("\r\n");
}

}

Thanks
Maz.

Mar 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
StringBuilder sb = new StringBuilder();
foreach (DataRow row in rows)
{
sb.Append(row["Mesg"].ToString());

if (row!=rows[rows.Length-1])
sb.Append("\r\n");
}
}

Mar 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.