Qustion regarding ASP.NET SQLDATAREADER

  • Thread starter Thread starter msnews.microsoft.com
  • Start date Start date
M

msnews.microsoft.com

Hi

Below is a code snippet that returns XML from SQL server... than I iterate
to get all records that are appended to a StringBuilder object

/** Pseudo Code **/
SQLReader = SQLCommand.ExecuteReader ();

while ( SQLReader.Read() )
{
StringBuilder.Append ( SQLReader.GetValue ( 0 ) );
}

return StringBuilder;

/** End Pseudo Code **/

Is there a better way to do it? All I need is to dump the result set in to
StringBuilder object...

Any ideas?

Thanks in advanced...

G...
 
Well to prevent boxing from happening you should use the
SQLReader.GetString(0) since GetValue passess back an object (I think) and
you do not want the StringBuilder to have to convert all of those values to
a string datatype. Its just a performance thing. Otherwise, for your
purposes, everything looks good.
 
Back
Top