Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear developers,

Is there any way that we can get the {raw materiel} of the data retrieved from a MSSQL before processing data?
Posted
Comments
Herman<T>.Instance 1-Dec-15 5:25am    
Why do you need the datasize?
[no name] 1-Dec-15 5:37am    
to make my decision, either to choose using a web service or directly connect to the database.
Richard Deeming 1-Dec-15 6:05am    
So you want to load the data using a direct connection in order to decide whether you're going to load the data using a direct connection or a web service?

That doesn't make any sense.
[no name] 1-Dec-15 9:11am    
You don't have to complain, if you don't know the answer it doesn't mean no solution is existed.
The whole idea is that I want to use a web service to improve the security of the database.. I know that the web server response size is larger than the regular SQL response since it contains extra XML tags, so I want to compare the regular size with web service's size and if there is no big difference then I will choose the web service.
I know I am making this complicated, I apologize
Thanks for your comment(s)
Richard Deeming 1-Dec-15 9:12am    
So it's an up-front decision about which technology to use, rather than an on-the-fly decision for each request?

I would not sacrifice security to get data to load faster. Can you not make use of a web service method that returns data in a compressed fashion after applying security? then you can have a secure and a fast web service.

If you have to get the size, then probably a generalization of Record Count * Column count * average cell size would be adequate to see if the data set is large.
 
Share this answer
 
Comments
[no name] 3-Dec-15 2:03am    
Thanks for this reply. can you please explain more about what you said "returns data in a compressed fashion after applying security"? what do you exactly mean by that?
FrancoisViljoen 3-Dec-15 9:34am    
Obviously I do not have a complete view of your whole application, but what you can possibly look at doing is to compress the response using a gzip stream and sending it over as a byte[]. The downside to this is that the consumer has to know what the byte[] actually contains and also how to unzip the information.
[no name] 5-Dec-15 3:18am    
can you please post some links about gzip?
FrancoisViljoen 5-Dec-15 6:01am    
Google GZipStream
Thank you everyone, I found the answer myself by using a method in SQLConnection called RetrieveStatistics which gave me the total size of bytes received and many other important Information I need.

You can check an example right here:

https://msdn.microsoft.com/en-us/library/7h2ahss8(v=vs.110).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900