One thing I'd recommend right up front is that you always include { and } around branching logic. It makes it far easier to read and troubleshoot. Also, you can use the StringBuilder.AppendFormat method for cleaner (and more efficient) string concatenation (particularly when using the string builder.
Try this:
for(int i=0;i<=ds.Tables[0].Rows.Count - 1; i++)
{
for(int j=0;j<=ds.Tables[0].Columns.Count - 1; j++)
{
str.AppendFormat("{0}\t", ds.Tables[0].Rows[i][j]);
}
str.Append("\n");
}
-
Peter