本文介绍了反序列化为DataSet - DataType?就像虫子一样。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在之前的帖子中读到,如果列类型设置为Date,我可以获取网格列以按日期时间排序


我反序列化我的XML和一个属性XSD的类型为dateTime,但在检查和行为中

时,数据类型为字符串。如果我在VISSTUDIO中使用GUI预览数据集,它会将我的数据类型显示为dateTime ..


如果我尝试休息数据类型,我会得到这个错误

附加信息:一旦有数据就无法更改列的DataType


这会添加2个新表..

FileStream finschema = new FileStream(schemaPath,FileMode。打开,FileAccess.Rea d,FileShare.Read)

ds.ReadXmlSchema(finschema);

finschema.Close()




System.Strin

System.Strin

System.Strin

System.String //应该有已经是dateTime !!

System.Strin

System.Strin

System.Int3



System.Strin

System.Int3

最后如果我试图休息数据类型我得到这个错误

附加信息:一旦有数据,就无法更改列的数据类型


有什么问题?谢谢Andre


?xml version =" 1.0"编码= QUOT; UTF-8英寸?>< xs:schema xmlns:xs =" http://www.w3.org/2001/XMLSchema" elementFormDefault =" qualified">< xs:element name =" transactionrecord">< xs:complexType>< xs:seque nce>< xs:element ref =" message" />< / xs:sequence>< xs:attribute name =" customercode"类型= QUOT; XS:串QUOT;使用= QUOT;可选" />< xs:attribute name =" model"类型= QUOT; XS:串QUOT;使用= QUOT;可选" />< xs:attribute name =" documentid"类型= QUOT; XS:串QUOT;使用= QUOT;可选" />< xs:attribute name =" transactiondate"类型= QUOT; XS:日期时间"使用= QUOT;可选" />< xs:attribute name =" transactiontype"类型= QUOT; XS:串QUOT;使用= QUOT;可选" />< / xs:complexType>< / xs:element>< xs:element name =" transactions">< xs:complexType>< xs:sequence>< xs:element ref =" transactionrecord" maxOccurs的= QUOT;无界" />< / xs:sequence>< xs:attribute name =" application"类型= QUOT; XS:串QUOT;使用= QUOT;可选" />< / xs:complexType>< / xs:element>< xs:element name =" message">< / xs:element>< / xs:schema>

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 gri
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 erro
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.Rea d,FileShare.Read)
ds.ReadXmlSchema(finschema);
finschema.Close()

Table
System.Strin
System.Strin
System.Strin
System.String // should have been dateTime !!
System.Strin
System.Strin
System.Int3
Table
System.Strin
System.Int3

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

What''s wrong ??? Thanks Andre

?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:seque nce><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>

推荐答案




这篇关于反序列化为DataSet - DataType?就像虫子一样。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 00:20