Deserialize to DataSet - DataType ? acts like bug.

From: andrewcw (andrewcw_at_acw.com)
Date: 05/14/04


Date: Fri, 14 May 2004 13:01:02 -0700

I read in a earlier post that I can get the column of a grid to sort by datetime if the column type was set as Date.

I deserialize my XML and one attribute of the XSD has type as dateTime but upon inspection and behavior in the grid
the data type is string. If I preview the dataset with the GUI in VISSTUDIO it shows my datatype to be dateTime ...

If I try to rest the datatype I get this error
Additional information: Cannot change DataType of a column once it has data.

This adds 2 new tables ...
FileStream finschema= new FileStream(schemaPath,FileMode.Open,FileAccess.Read,FileShare.Read);
ds.ReadXmlSchema(finschema);
finschema.Close();

Table 0
System.String
System.String
System.String
System.String // should have been dateTime !!!
System.String
System.String
System.Int32
 Table 1
System.String
System.Int32

Finally if If I try to rest the datatype I get this error
Additional information: Cannot change DataType of a column once it has data.

What's wrong ??? Thanks Andrew

?xml version="1.0" encoding="UTF-8" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"><xs:element name="transactionrecord"><xs:complexType><xs:sequence><xs:element ref="message" /></xs:sequence><xs:attribute name="customercode" type="xs:string" use="optional" /><xs:attribute name="model" type="xs:string" use="optional" /><xs:attribute name="documentid" type="xs:string" use="optional" /><xs:attribute name="transactiondate" type="xs:dateTime" use="optional" /><xs:attribute name="transactiontype" type="xs:string" use="optional" /></xs:complexType></xs:element><xs:element name="transactions"><xs:complexType><xs:sequence><xs:element ref="transactionrecord" maxOccurs="unbounded" /></xs:sequence><xs:attribute name="application" type="xs:string" use="optional" /></xs:complexType></xs:element><xs:element name="message"></xs:element></xs:schema>



Relevant Pages

  • Re: Input Mask on Date for Year or Month Only
    ... If you wish to use the DateTime functions, then the field's datatype ... format, the stored value must contain the day as well. ... mm-yyyy format, i.e. 08/2008 or 08-2008. ...
    (microsoft.public.access.gettingstarted)
  • Bulk Insert - How to represent nulls in .txt input file?
    ... I have a table that I'm loading via .txt file input. ... One of the columns has a datatype of datetime. ... way to pass a null to a datetime field that allows nulls. ...
    (microsoft.public.sqlserver.dts)
  • Re: Converting and formatting DATE field
    ... SQLServer does not have a date only datatype, therefore it will store a time ... If you don't specify the time portion when the datetime is inserted ... > I would like to be able to format this date and show only ...
    (microsoft.public.sqlserver.programming)
  • Re: Input Mask on Date for Year or Month Only
    ... Can I use an input mask to caputre only the year or only the month? ... If you wish to use the DateTime functions, then the field's datatype ... format, the stored value must contain the day as well. ...
    (microsoft.public.access.gettingstarted)
  • Re: problem to insert data
    ... > i have an insertion problem with my rtu table ... > datatype for date1 field is: datetime ...
    (comp.lang.c)