NextResult () forces the reader to move on to the next set of results returned from the request. As you wrote it, it will skip the first set of results (most likely the only one).
I think you need a template:
if (reader.HasRows)
{
do
{
while (reader.Read())
{
...
}
}
while (reader.NextResult());
}
, - , , , .
EDIT: :
JSON , DataContractJsonSerializer:
public class DateClass
{
public string AvgDate { get; set; }
public int MarkerID { get; set; }
}
...
var dates = new List<DateClass>();
if (reader.HasRows)
{
while (reader.Read())
{
var date = new DateClass { AvgDate = reader["AvgDate"].ToString(), MarkerID = (int)reader["MarkerID"] };
dates.Add( date );
}
}
var stream = new MemoryStream();
var serializer = new DataContractJsonSerializer( typeof(DateClass) );
serializer.WriteObject( stream, dates );
stream.Seek( 0, SeekOrigin.Begin );
return stream.ToString();