Use [code] [/code] tags. It makes it a lot easier to talk about your code when you can refer to line numbers and it actually has some formatting to it.
And you have your loops wrong. There won't be any data to write they way you've set it up.
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
Lines 53-75 is where you'll have the problem (as you noted). Write it to the file just like you were writing it to the console:
while (rdr.Read()) {
wl.WriteLine(String.Format("{0} {1} {2}",
rdr[0].ToString().PadLeft(10),
rdr[1].ToString().PadLeft(10),
rdr[2].ToString().PadLeft(10));
}
// close reader
rdr.Close();
// flush the file
wl.Flush();
// close the file
wl.Close();
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
Calling WriteLine on the rdr causes it to call the ToString() method on the rdr. ToString on an object generally returns the class of the object.
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
Look back 4 posts where I gave the answer.
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558