Subject: Re: Sort DataView according to Integer
Date: Fri, 4 Jun 2004 13:12:05 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Lines: 483
Message-ID: <
[email protected]>
Organization: Tiscali bv
NNTP-Posting-Date: 04 Jun 2004 13:12:07 CEST
NNTP-Posting-Host: 213.177.151.7
X-Trace: 1086347527 dreader2.news.tiscali.nl 41760 213.177.151.7:4684
X-Complaints-To: (e-mail address removed)
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
phx.gbl!newsfeed00.sul.t-online.de!t-online.de!irazu.switch.ch!switch.ch!ne
wsfeed1.ip.tiscali.net!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscal
i.nl!not-for-mail
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:54534
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
Thanks for that! It seems to be working fine now! The problem was that I
first loaded the data and then loaed the XML Schema from an XSD file.
However, when the XSD was loading up correctly (sequenceNumber type is
Int32) data was not loaded at all (but I didn't get an error message
either!) - I tried changing a couple of things in the schema but still
didn't work. So I ended up using a programmatically defined schema which did
solve my problem.
It's all good now, I'm just not too happy about the fact that I can't use an
XSD schema and the fact that I don't have a primary key in one of my
productsTable (using the programmatically defined schema). Here's the code
for the XSD schema... Maybe I have to change the targetNamespace for the
data to load up ? thanks again to both of you !
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="
http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns="
http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="
http://tempuri.org/XMLSchema.xsd"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="customersTable" msdata:IsDataSet="false">
<xs:complexType>
<xs:sequence></xs:sequence>
<xs:attribute name="customerID" type="xs:int" />
<xs:attribute name="customerEmail" type="xs:string" />
<xs:attribute name="sequenceNumber" type="xs:integer" />
<xs:attribute name="reasonCode" type="xs:string" />
<xs:attribute name="showOnList" type="xs:boolean" />
<xs:attribute name="orderNumber" type="xs:string" />
<xs:attribute name="ndd" type="xs:string" />
<xs:attribute name="customerComments" type="xs:string" />
<xs:attribute name="customerDelivered" type="xs:boolean" />
<xs:attribute name="customerTelephone" type="xs:string" />
<xs:attribute name="customerCity" type="xs:string" />
<xs:attribute name="customerZip" type="xs:string" />
<xs:attribute name="customerStreet" type="xs:string" />
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
<xs:key name="customersTableKey1">
<xs:selector xpath="." />
<xs:field xpath="@orderNumber" />
</xs:key>
</xs:element>
<xs:element name="productsTable" msdata:IsDataSet="false">
<xs:complexType>
<xs:sequence></xs:sequence>
<xs:attribute name="customerID" type="xs:int" />
<xs:attribute name="orderNumber" type="xs:string" />
<xs:attribute name="retQty" type="xs:int" />
<xs:attribute name="delQty" type="xs:int" />
<xs:attribute name="product" type="xs:string" />
<xs:attribute name="productID" type="xs:string" />
</xs:complexType>
<xs:key name="productsTableKey1">
<xs:selector xpath="." />
<xs:field xpath="@orderNumber" />
</xs:key>
<xs:keyref name="customersTableproductsTable" refer="customersTableKey1">
<xs:selector xpath="." />
<xs:field xpath="@orderNumber" />
</xs:keyref>
</xs:element>
</xs:schema>
Ilya Tumanov said:
If you have a separate schema file, it has to be loaded first.
If you load data first, schema (data can not be stored without schema) will
be inferred and all type information will be lost.
Loading schema after data will not change column types since it's not
possible once column is created.
Schema from file will be mostly ignored in that case.
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
jez said:
Ryan, Ilya, thanks to both for the reply!
So I have tested the type and I guess you were both right.. the schema is
not properly loaded. The type is string for sequenceNumber. For a boolean
that I use in my application the type is also string. It seems like
the
type
for each field is string. I do think that the XSD file is loaded to some
extent though because I first read an XML file to populate a DataSet and
then I 'read' the XSD schema and get no error. Is that possible ? If
so
what
am I doing wrong ? Here's the code I use to read the xml file and the xsd
schema. I first read the xml and then load the xsd :
_CustomersDS.ReadXml(getFullPath() + @"\deliveryfile.xml");
_CustomersDS.Namespace = "myNameSpace";
_CustomersDS.DataSetName = "_CustomersDS";
//import relations schema
_CustomersDS.ReadXmlSchema(getFullPath() + @"\schema.xsd");
_CustomersDS.Namespace = "myNameSpace";
_CustomersDS.DataSetName = "_CustomersDS";
thanks!
Hey Jez:
It shouldn't matter where the data comes from, the real issue is the
current
type and it sounds like you're ok there. I've done this every way I know
how . The only two things I can see is if the RowFilter criteria was
filtering stuff out, but that would make stuff appear or not, it wouldn't
change the order. I'm guessing that although DisplayMember and
ValueMember
are different fields altogether from sequenceNumber, you've verified that
those numbers are the way it's sorting, sequenceNumber vs. customerId.
Just
for giggles, would you mind verifyting the DataTypes of each of the
columns
pramatically? customerTable.Columns["sequenceNumber"].DataType;
just
to get
the has sort
the can
sort
Ilya Tumanov said:
If you have a separate schema file, it has to be loaded first.
If you load data first, schema (data can not be stored without schema) will
be inferred and all type information will be lost.
Loading schema after data will not change column types since it's not
possible once column is created.
Schema from file will be mostly ignored in that case.
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
jez said:
Ryan, Ilya, thanks to both for the reply!
So I have tested the type and I guess you were both right.. the schema is
not properly loaded. The type is string for sequenceNumber. For a boolean
that I use in my application the type is also string. It seems like
the
type
for each field is string. I do think that the XSD file is loaded to some
extent though because I first read an XML file to populate a DataSet and
then I 'read' the XSD schema and get no error. Is that possible ? If
so
what
am I doing wrong ? Here's the code I use to read the xml file and the xsd
schema. I first read the xml and then load the xsd :
_CustomersDS.ReadXml(getFullPath() + @"\deliveryfile.xml");
_CustomersDS.Namespace = "myNameSpace";
_CustomersDS.DataSetName = "_CustomersDS";
//import relations schema
_CustomersDS.ReadXmlSchema(getFullPath() + @"\schema.xsd");
_CustomersDS.Namespace = "myNameSpace";
_CustomersDS.DataSetName = "_CustomersDS";
thanks!
Hey Jez:
It shouldn't matter where the data comes from, the real issue is the
current
type and it sounds like you're ok there. I've done this every way I know
how . The only two things I can see is if the RowFilter criteria was
filtering stuff out, but that would make stuff appear or not, it wouldn't
change the order. I'm guessing that although DisplayMember and
ValueMember
are different fields altogether from sequenceNumber, you've verified that
those numbers are the way it's sorting, sequenceNumber vs. customerId.
Just
for giggles, would you mind verifyting the DataTypes of each of the
columns
pramatically? customerTable.Columns["sequenceNumber"].DataType;
just
to get
the has sort
the can
sort