A DataReader is not serializable as XML. If you want to store a result set
in ViewState, use a DataTable or DataSet.

Signature
HTH,
Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com
The shortest distance between 2 points is a curve.
> Has anyone had a serialization error occur when adding a variable to a
> viewstate? The error states 'Error serializing value
> 'System.Data.SqlClient.SqlDataReader' . It does not mention
> explicitly that it is from the viewstate, however, when I remove the
> code for adding the data reader to the viewstate, I don't get the
> error. I'm not having any luck trying to troubleshoot this online.
mianiro - 27 Feb 2007 18:27 GMT
> A DataReader is not serializable as XML. If you want to store a result set
> in ViewState, use a DataTable or DataSet.
[quoted text clipped - 16 lines]
>
> - Show quoted text -
Thank you! That worked