Returning 2-dimensional array via C#
===

So basically, I'm getting content from a database and returning it for AJAX processing via JavaScript. Pretty simple stuff. The issue here is that I can't seem to find a good way to loop through the data and the MSDN documentation is obscenely poor for its odbcreader methods.

    using (OdbcCommand com = new OdbcCommand("SELECT * FROM pie_data WHERE Pie_ID = ?", con)) {
        if (Request.Form["reference_id"] == "") {
		    returnError();
	    } else {
		    com.Parameters.AddWithValue("", Request.Form["reference_id"]);
			com.ExecuteNonQuery();
			using (OdbcDataReader reader = com.ExecuteReader()) {
				string finalstring = "";
				while (reader.Read()) {
					if(reader.HasRows) {
						finalstring = reader.GetString(9) + ",";
						for (int i = 0; i <= 8; i = i + 1) {
							finalstring = finalstring + reader.GetValue(i).ToString() + ",";
						}
						finalstring = finalstring + "|";
						reader.NextResult();
					}
				}
				if (finalstring != "") {
					finalstring = finalstring.Remove(finalstring.Length -1, 1);
					Response.Write(finalstring);
				}
			}
			noredirect = 1;
		}
	}

However, here is sample output:

    00001,0,Pie Johnson,piesaregreat@yum.com,,,10/7/2010 12:00:00 AM,Bakery,N/A,N/A,

As you can tell the second deliminator is not appearing at all, hen it really should. Also, this query, when run in heidisql, returns a good number of rows, not just this one result.

Once I have it passed to the JavaScript, I can figure it out since I have much more experience with that and I've actually done this before via PHP.