2

As AJAX is becoming more ubiquitous, and its' benefits for reporting are enormous, either with dynamic pagination or huge static html tables with dynamic values, I always needed an easy way to dump my DataSets directly into JSON export (especially since you can't simply Return one in a WebMethod, a badly needed "feature").

How can this be done?

  • But a dataset has a lot more than just data - it is a class with a lot of methods. My question is why dataset? For speed and memory I would use a DataReader. – paparazzo Jan 25 '13 at 23:58
  • DataReader can deal with multiple result sets (and was not part of the question). If it going into a dicitionary then why deal with the overhead of a DataSet? If you are happy with memory spikes and slow code then keep on coding that way. I do this for a living and 0.1 second faster to a and user less memory on server counts for me. – paparazzo Jan 26 '13 at 02:54
  • I don't have a problem and I code for performance not lines of code. My first comment was speed and memory and you asked me to elaborate. Now you are saying it is only about lines of code. – paparazzo Jan 26 '13 at 14:13
  • Yeah I mean if that's an issue just put them all on one line. Memory, speed , footprint, robustness, comprehensibilty or even if you are some sort of weirdo terseness, LOC, point missed. – Tony Hopkinson Jan 26 '13 at 23:40
  • With a compiled method, so why are you concerned with number of lines in the source? You also need to find out about connection pooling. In general persisting a connection is a bad idea in .net. ADO.net is designed to take care of that for you and fighting it, is often counter-productive. DataReader instead of Dataset is worth a look, as are using blocks. This is how I would do it in LAMP, is not going to be a great guide for .net. That would be like trying to write VB as you would PHP. – Tony Hopkinson Jan 27 '13 at 00:51
  • @JoeCoderGuy I'm afraid I have to completely and totally disagree with you.If we are going to continue this, this is the wrong place. – Tony Hopkinson Jan 27 '13 at 18:29
  • Sigh. You asked a bout lines of code. Blam said datareader because it's light, it has nowhere near the level of functionality of Dataset, and therefore will will result in far less IL. Compiled code, the stuff you want to perform! As for les code = less dev time, 70% of coding time is time to comprehend the code, typing is irrelevant. – Tony Hopkinson Jan 28 '13 at 09:52

0 Answers0