none
How to define a datacolumn of int[] type using DataSet designer? RRS feed

  • Question

  • Hello,
    I'm using typed datasets. Though it isn't possible controlling the data column mapping type (element / attribute / data) it is still possible to do a lot of things. Some actions that were missed in the IDE can be done by direct editing of the XSD file. Now I'm stuck with the issue that i can't solve with IDE nor with XSD editing. I need to define a column of the int[] type.
    Anyone can help? The minimum what i'm looking for is a string naming this type so MSDataSetGenerator can translate the xs:type attribute into integer array.

    Thank you.
    Thursday, October 16, 2008 10:41 AM

Answers

  • You should be able to edit the DataColum.DataType in the Visual Studio Editor.

    I typed "System.Int32[]" and that worked.

     

    If that doesn't work for you, then editing the xsd file manually, the xml would look something like

    <xs:element

    name="MyColumnName"

    msdataBig SmileataType="System.Int32[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

    type="xs:anyType"

    minOccurs="0" />

    Friday, October 17, 2008 1:02 AM
    Moderator

All replies

  • You should be able to edit the DataColum.DataType in the Visual Studio Editor.

    I typed "System.Int32[]" and that worked.

     

    If that doesn't work for you, then editing the xsd file manually, the xml would look something like

    <xs:element

    name="MyColumnName"

    msdataBig SmileataType="System.Int32[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

    type="xs:anyType"

    minOccurs="0" />

    Friday, October 17, 2008 1:02 AM
    Moderator
  • Hello,
    It looks like this solution is working for element, but it doesn for attribute. When trying to open the dataset in the designer i get the following error: Type 'http://www.w3.org/2001/XMLSchema:anyType' is not declared, or is not a simple type.
    Thank you anyway. I'll use it as an element type instead.
    Thursday, October 23, 2008 3:06 PM
  • I was able to reproduce the failure of reading the xsd schema when a DataColumn mapped as attribute has an Int32[] DataType.  Not the greatest error message from the designer.

     

    From the DataSet itself, the error message I see is:

    System.ArgumentException: DataColumn with type 'System.Int32[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is a complexType. Can not serialize value of a complex type as Attribute.

    So it does look like using an element type is your only choice for arrays.

    Friday, October 24, 2008 4:31 PM
    Moderator