Using an ajax call I get data by'CreateReport' method.
Here is my ajax call:
$.ajax({
type: "POST",
url: "Service.asmx/CreateReport",
data: "{'reportname':'" + ReportID + "','datasourceid':'" + DataSourceId[i] + "','parameter':'" + Parameter + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
index: i,
success: function (response) {
numberofquery = numberofquery + 1;
var Query = response.d;
store_data(Query, this.index);
function store_data(Query, i) {
try {
if (Query != null || Query != "") {
Query = JSON.parse(Query);
window[QueryName[i]] = [];
window[QueryName[i]] = Query;
}
}
catch (err) { }
}
},
async: true,
error: function (msg)
{
numberofquery = numberofquery + 1;
CustomAlertShow("Error");
},
complete: function () {
if (numberofquery == totalquery) GenerateWithReloadedData();
},
});
And here is my method in service.
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string CreateReport(string reportname, string datasourceid, string parameter)
{
try
{
DataSet dataSet1 = new DataSet();
SqlConnection cn1 = new SqlConnection(ConStr);
string queryString = "Select ReportID, DataSourceID from dbo.ReportDataSourceDataModel "
SqlDataAdapter daGlobalClass = new SqlDataAdapter(queryString, cn1);
cn1.Open();
daGlobalClass.Fill(dataSet1, "myDataTable");
cn1.Close();
return JsonConvert.SerializeObject(dataSet1.Tables[0]);
}
catch (SqlException ex)
{
return "-ERR: " + DisplaySqlErrors(ex);
}
}
In general it works fine when dataset1 has around 100000 data. But this service doesn't work for large amount of data.
How can I get over million data through this webservice anad using this ajax call ?