Display data as soon as it comes
-
hi My requirement is below. Let's say i am getting 1 lakh records from DB.(using xmlhttp). now as soon as i get 100 records i need to display them, then again as soon as i get next set of records i should be displaying it. Means to say that the user should not wait for long time to view all the records, he should be getting records as soon as it comes. THanks in advance
Thanx in Advance
-
hi My requirement is below. Let's say i am getting 1 lakh records from DB.(using xmlhttp). now as soon as i get 100 records i need to display them, then again as soon as i get next set of records i should be displaying it. Means to say that the user should not wait for long time to view all the records, he should be getting records as soon as it comes. THanks in advance
Thanx in Advance
In principle, what you are trying to do is pretty straightforward. Fetch the first n records. Display them. Fetch the next n records. Display them. And so on... Are you having difficulty with the implementation of this? Use the TOP predicate in your database queries to fetch blocks of n records.
Paul Marfleet
-
In principle, what you are trying to do is pretty straightforward. Fetch the first n records. Display them. Fetch the next n records. Display them. And so on... Are you having difficulty with the implementation of this? Use the TOP predicate in your database queries to fetch blocks of n records.
Paul Marfleet
thanks for the quick reply Paul. I guess what u r saying is get 100 records and display them and then again get another set 100 records and append them to the previous. I guess this will do wht i want but this will make me call db 100 times if i have 1 lakh records. What i want is to request 1 lakhs record in one call to db and as soon as i get any no of records i should be displying it.
Thanx in Advance
-
thanks for the quick reply Paul. I guess what u r saying is get 100 records and display them and then again get another set 100 records and append them to the previous. I guess this will do wht i want but this will make me call db 100 times if i have 1 lakh records. What i want is to request 1 lakhs record in one call to db and as soon as i get any no of records i should be displying it.
Thanx in Advance
AFAIK, this isn't possible. Either you fetch all of the data in one synchronous request, or you make multiple requests for blocks of n records. If the data didn't change often, you could consider implementing the Singleton pattern and cache it in a DataSet or something similar on the server. You could then fetch blocks of this data without having to make subsequent calls to the database. Obviously there would be memory implications in storing a large dataset in memory. BTW, by 'lakh' I assume you mean 100,000? I don't think this word is in common use outside of the Indian subcontinent. I had to look it up to see what it meant!
Paul Marfleet
-
AFAIK, this isn't possible. Either you fetch all of the data in one synchronous request, or you make multiple requests for blocks of n records. If the data didn't change often, you could consider implementing the Singleton pattern and cache it in a DataSet or something similar on the server. You could then fetch blocks of this data without having to make subsequent calls to the database. Obviously there would be memory implications in storing a large dataset in memory. BTW, by 'lakh' I assume you mean 100,000? I don't think this word is in common use outside of the Indian subcontinent. I had to look it up to see what it meant!
Paul Marfleet
yes Paul it means 100,000 Well i had seen this working in my current asp application and i m trying to replicate the same in .net but struggling with it. i can tell u how it is working in asp application. below is the code of how it is implemented in asp response.buffer = false ' Sub DisplayRecords() sql = "spPatientSelectList " set oRs = oConn.execute(sql) if (oRs.eof) then response.write "No record found" & vbCrLf end if do while not oRs.eof response.write "" response.write "" & oRs("vchMedRecNum") & "" response.write "" & oRs("vchPatientFirstName") & "" response.write "" & oRs("vchPatientLastName") & "" response.write "" & oRs("dtPatientDateOfBirth") & "" response.write "" & oRs("vchPatientContactNumber") & "" response.write "" & oRs("vchPatientSSN") & "" response.write "" & vbCrLf oRs.moveNext loop oRs.close U see the key in the above code is response.buffer=false. but implementing the same in dotnet doesn't seems to help.
Thanx in Advance
-
yes Paul it means 100,000 Well i had seen this working in my current asp application and i m trying to replicate the same in .net but struggling with it. i can tell u how it is working in asp application. below is the code of how it is implemented in asp response.buffer = false ' Sub DisplayRecords() sql = "spPatientSelectList " set oRs = oConn.execute(sql) if (oRs.eof) then response.write "No record found" & vbCrLf end if do while not oRs.eof response.write "" response.write "" & oRs("vchMedRecNum") & "" response.write "" & oRs("vchPatientFirstName") & "" response.write "" & oRs("vchPatientLastName") & "" response.write "" & oRs("dtPatientDateOfBirth") & "" response.write "" & oRs("vchPatientContactNumber") & "" response.write "" & oRs("vchPatientSSN") & "" response.write "" & vbCrLf oRs.moveNext loop oRs.close U see the key in the above code is response.buffer=false. but implementing the same in dotnet doesn't seems to help.
Thanx in Advance
You can still use
Response.Buffer = false;
to disable buffering of output in ASP.NET. In your example, the database query is executed synchronously. The ASP code has to wait for it to fully complete. Disabling buffering just means that a partial response can be sent to the client instead of being accumulated on the server and flushed out in 1 go.Paul Marfleet
-
You can still use
Response.Buffer = false;
to disable buffering of output in ASP.NET. In your example, the database query is executed synchronously. The ASP code has to wait for it to fully complete. Disabling buffering just means that a partial response can be sent to the client instead of being accumulated on the server and flushed out in 1 go.Paul Marfleet
exactly Paul. and that's what i am trying to do in asp.net. But struggling big time with this.
Thanx in Advance
-
exactly Paul. and that's what i am trying to do in asp.net. But struggling big time with this.
Thanx in Advance
I think you need to go back to first principles. Consider whether it is necessary or appropriate to display 100,000 records on a page. There are a number of problems with this. Firstly, the size of your HTTP response is going to be huge, putting pressure on your web server. Secondly, your users are going to have to wait some significant time for the page to download, even if you switch buffering off. Thirdly, do your users want ot need to view 100,000 records at once? I don't think I could make sense of so much information. IMHO, no more than 100-150 records should be displayed on a page at any one time. You should consider implementing some sort of paging/filtering mechanism to allow your users to get to the data they need. Yes, multiple requests would be made to the database as the user filters the data or moves through the pages. However it is surely better application design for your users to be making multiple requests for 100-150 records instead of a single request for 100,000 records.
Paul Marfleet