Cis Pa

Cis Pa

  • 2k
  • 194
  • 11.2k

Return DataSet in REST Web Api and return as dataset in Clientapp

Jun 8 2021 3:07 AM

Hi all,

I was trying to return a result as Dataset in REST Web Api and consume in client application as Dataset .

Is it possible to return result as Dataset into Rest web api  and am getting error "Additional text found in JSON string after finishing deserializing object." plz help.

public Dataset Getstudent(string schoolId)
        SqlDataAdapter da = new SqlDataAdapter("Getstudent", con);
        DataTable ds = new DataTable();
        da.SelectCommand.CommandType = CommandType.StoredProcedure;
        SqlParameter ret = new SqlParameter();
        ret.Direction = ParameterDirection.ReturnValue;
        da.SelectCommand.Parameters.Add("@schoolId", SqlDbType.VarChar, 20).Value = schoolId;
        return Ok(ds);    
private async  Task StoredDataset()
    DataSet ds = new DataSet();

    var resultapi =  client.GetAsync(builder.Uri).Result;
    if (resultapi.IsSuccessStatusCode)
        var jsonString = await resultapi.Content.ReadAsStringAsync();
        ds = JsonConvert.DeserializeObject(jsonString);


Answers (1)