Read from the MSSQL 1000 records, on the analysis of the analyzer test, there is less than one second out of the results
But in c #, each record to
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
foreach (DataRow rs in dt. Rows)
{
Ii++;
JObject jOb=new JObject ();
JOb. The Add (new JProperty (" SourceID ", rs (" SourceID ")));
JOb. The Add (new JProperty (" RoomNum ", rs (" RoomNum ")));
,,,,,,,,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Was used for a long time, then I will jOb this object into a string jobj. The ToString (), found that this takes longer, for some reason,
Description, the job each record is
{
"SourceID" : 8243,
"RoomNum" : "0202",
"SourceTag: \ u9614 \ u7ef0 \ u4e09 \ u623f, \ u5357 \ u5317 \ u901a \ u900f, \ u5165 \ u6237 \ u82b1 \ u56ed",
"Housetypes" : "3 \ u623f2 \ u5385,"
"CoveredArea" : 119.68,
"Floors" : 2,
"SourceImg" : ", "house/2020 _4/30/s_20200430085521VTL000. JPG",
"Oneprice" : 6161.0,
"Totprice" : 737348.5,
"IsOnline" : true,
"IsSold" : false,
"HouseTypeID" : 97
},
Article 981, save for the text is 379 k, take a few minutes, but when debugging results is what is going wrong, please tall person to give directions, thank you very much!
CodePudding user response:
Do you want the datatable turn json? Direct transfer, don't turn this into a JObjectRefer to Microsoft's Newtonsoft. Json;
JsonConvert. SerializeObject (ds) is the json packet, written and you have a question, why
JObject jOb=new JObject ();
JOb. The Add (new JProperty (" SourceID ", rs (" SourceID ")));
JOb. The Add (new JProperty (" RoomNum ", rs (" RoomNum ")));
Should not create a list
Then
For ()
{
JObject b=new JObject ();
B.l ie=zhi;
A.a dd (b);
}
You are also a few more writing will know where is the actual waste
CodePudding user response:
This splice themselves control, others belong to the popularization of the packaging, not suitable for youCodePudding user response:
The query analyzer you count it detailed list is nearly 1000 rows?CodePudding user response:
Basically, even 1 million lines, query analyzer told "seconds told" you have 1 million lines of the query results, and then when you serialize to asp.net controls also have a few minutes? ! Don't need to see, don't get the client, if don't get what the DataGrid, HTML can see memory object stored data can neither make what asp.net controls, senior strongly typed objects can need not use low-level string to organize JObject,