[Mono-dev] Column.ExtendedProperties

Alain Rodríguez Cuello alainrc2005 at yahoo.com
Thu Dec 24 18:41:07 EST 2009


Hi,

When i change column.ExtendedProperties, DataSet.GetXmlSchema:


DataSet ds = new DataSet("REGISTERS");

                        ds.Tables.Add("Table1");

                        ds.Tables["Table1"].Columns..Add("column1",typeof(System.String));

                        ds.Tables["Table1"].Columns..Add("column2",typeof(System.String));

                        

/* Without next two line program it run Ok*/

                        ds.Tables[0].Columns[0].MaxLength = 10;

                        ds.Tables[0].Columns[1].MaxLength = 10;

                        

                        ds.Tables["Table1"].Rows.Add("Alain", "Ramirez");

                        

                        ds.AcceptChanges();

                        ds.WriteXml("/tmp/Alain.xml",XmlWriteMode.WriteSchema);

                        

                        ds.ExtendedProperties.Add("test1","x1x");

                        ds.WriteXml("/tmp/Alain.xml",XmlWriteMode.WriteSchema);  /* OK */

                        ds.Tables[0].ExtendedProperties.Add("test2","1x1");

                        ds.WriteXml("/tmp/Alain.xml",XmlWriteMode.WriteSchema);  /* OK */

                        ds.Tables[0].Columns[0].ExtendedProperties.Add("test3","xxx");

                        ds.WriteXml("/tmp/Alain.xml",XmlWriteMode.WriteSchema); /* FAIL */


ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR:



Unhandled Exception: System.InvalidOperationException: This XmlWriter does not accept Attribute at this state Content.

  at System.Xml.XmlTextWriter.WriteStartAttribute
(System.String prefix, System.String localName, System.String
namespaceUri) [0x00000] 
  at System.Data.XmlSchemaWriter.AddExtendedPropertyAttributes (System.Data.PropertyCollection props) [0x00000] 

  at System.Data.XmlSchemaWriter.WriteTableTypeParticles (System.Data.DataColumn col) [0x00000] 

  at System.Data.XmlSchemaWriter.WriteTableType (System.Data.DataTable table) [0x00000] 

  at System.Data.XmlSchemaWriter.WriteTableElement (System.Data.DataTable table) [0x00000] 

  at System.Data.XmlSchemaWriter.WriteDataSetElement () [0x00000] 

  at System.Data.XmlSchemaWriter.WriteSchema () [0x00000] 

  at System.Data.XmlSchemaWriter.WriteXmlSchema
(System.Data.DataSet dataset, System.Xml.XmlWriter writer,
System.Data.DataTableCollection tables,
System.Data.DataRelationCollection relations) [0x00000] 
  at System.Data.XmlSchemaWriter.WriteXmlSchema (System.Data.DataSet dataset, System.Xml.XmlWriter writer) [0x00000] 

  at System.Data.DataSet.DoWriteXmlSchema (System.Xml.XmlWriter writer) [0x00000] 

  at System.Data.DataSet.WriteXmlSchema (System.Xml.XmlWriter writer) [0x00000] 

  at System.Data.DataSet.WriteXmlSchema (System.IO.TextWriter writer) [0x00000] 

  at System.Data.DataSet.GetXmlSchema () [0x00000] 

  at testConsole.MainClass.Main (System.String[] args) [0x00000] 



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091224/46920856/attachment.html 


More information about the Mono-devel-list mailing list