Using SQL DataReader Efficiently

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my web service application, I am very interested in minimizing the amount
of data that I have to transmit over the internet. I have thousands of rows
so I am interested in minimizing unnecessary characters where ever possible.

When I was first starting, it was easier to just not deal with null values
in my database but set defauts for everything. Then I use a sqldatareader to
populate an array of structures which I then serialize, compress and send
over the web service as a byte array.

Now I would like to tighten down on unnecessary characters and am wondering
if it would be better to let sql data fields that currently lack data sit a
nulls.

Now, for example, say I am using my SQLDataReader to read a "text" SQL
column into a net string variable. Am I looking at first checking the
datareader value for null and if null setting the stirng variable to "" or is
there a better way to deal with nothing values.

Fred Herring
 
In the 1.1 version of the Framework there is a DataReader.HasRows property
that returns a Boolean you can use.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top