[Mono-dev] System.Data.DataSet ReadXml question

Chris Micacchi mono at kinitos.com
Thu Sep 8 17:30:49 EDT 2005


I have a program that creates a DataTable with a column of type 
System.Version, and then writes out the dataset containing the table to 
an XML file using DataSet.WriteXml().  The resulting file looks fine, 
but when I then use DataSet.ReadXml() to re-read the data back into the 
dataset, I get this:

Unhandled Exception: System.InvalidCastException: Unknown target 
conversion type
in <0x0065c> System.Convert:ToType (System.Object value, System.Type 
conversionType, IFormatProvider provider)
in <0x00032> System.Convert:ChangeType (System.Object value, System.Type 
conversionType)
in <0x0030e> System.Data.XmlDataReader:StringToObject (System.Type type, 
System.String value)
in <0x001d3> System.Data.XmlDataReader:ReadElementElement 
(System.Data.DataRow row)
....

It looks like it's trying to convert the stringified version number back 
to a System.Version and hitting a brick wall.  Am I doing something 
wrong here?  I've attached a small sample program that hits this problem 
for me, in case it helps.  Compile it with
	mcs datasettest.cs -out:datasettest.exe -r:System.Data


Thanks for any insight!

Chris Micacchi
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: datasettest.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050908/c17b8584/attachment.pl 


More information about the Mono-devel-list mailing list