My problem is that this does not work;
while (reader.Read())
{
if (reader.NextResult() == true)
{
json.AppendFormat("{{\"AvgDate\": \"{0}\"}},{{\"MarkerID\": \"{1}\"}},", reader["AvgDate"], reader["MarkerID"]);
}
But this works;
while (reader.Read())
{
json.AppendFormat("{{\"AvgDate\": \"{0}\"}},{{\"MarkerID\": \"{1}\"}},", reader["AvgDate"], reader["MarkerID"]);
}
The problem with the first one is that the reader doesn't find any data to read. I get;
"Invalid attempt to read when no data is present."
Can anyone see why?