To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Display Modes
Old Feb 15th, 2007, 12:11 AM   #1
Tengkorak
Lively Member
 
Tengkorak's Avatar
 
Join Date: Nov 06
Location: Jakarta, Indonesia
Posts: 127
Tengkorak is an unknown quantity at this point (<10)
[02/03] Query + Filter data on XML File ?

Hello alls,

i have problem about query and filter data on xml file.
my xml file structure like this :

Code:
<Inventory>
	<xs:schema id="Inventory" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
		<xs:element name="Inventory" msdata:IsDataSet="true">
			<xs:complexType>
				<xs:choice maxOccurs="unbounded">
					<xs:element name="Customers">
						<xs:complexType>
							<xs:sequence>
								<xs:element name="CustomerID" type="xs:string" minOccurs="0" />
								<xs:element name="CompanyName" type="xs:string" minOccurs="0" />
								<xs:element name="ContactName" type="xs:string" minOccurs="0" />
								<xs:element name="ContactTitle" type="xs:string" minOccurs="0" />
								<xs:element name="Address" type="xs:string" minOccurs="0" />
								<xs:element name="City" type="xs:string" minOccurs="0" />
								<xs:element name="Region" type="xs:string" minOccurs="0" />
								<xs:element name="PostalCode" type="xs:string" minOccurs="0" />
								<xs:element name="Country" type="xs:string" minOccurs="0" />
								<xs:element name="Phone" type="xs:string" minOccurs="0" />
								<xs:element name="Fax" type="xs:string" minOccurs="0" />
								<xs:element name="Pin" type="xs:string" minOccurs="0" />
								<xs:element name="SalesID" type="xs:string" minOccurs="0" />
								<xs:element name="StsKunjugan" type="xs:boolean" minOccurs="0" />
							</xs:sequence>
						</xs:complexType>
					</xs:element>					
				</xs:choice>
			</xs:complexType>
		</xs:element>
	</xs:schema>
	<Customers>
		<CustomerID>TBW</CustomerID>
		<CompanyName>Toko Berani Wangi</CompanyName>
		<ContactName>Kosasih</ContactName>
		<ContactTitle>Owner</ContactTitle>
		<Address>Pertokoan Mayestik</Address>
		<City>Jakarta</City>
		<PostalCode>05023</PostalCode>
		<Country>Mexico</Country>
		<Phone>(5) 555-3932</Phone>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>YH</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>TWWS</CustomerID>
		<CompanyName>Toko Wangi-Wangi Segar</CompanyName>
		<ContactName>Linda</ContactName>
		<ContactTitle>Owner</ContactTitle>
		<Address>Pertokoan Tebet Barat</Address>
		<City>Jakarta</City>
		<PostalCode>13008</PostalCode>
		<Country>France</Country>
		<Phone>91.24.45.40</Phone>
		<Fax>91.24.45.41</Fax>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>YH</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>MPIMI</CustomerID>
		<CompanyName>Metro PIM I</CompanyName>
		<ContactName>Margaret</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Margaguna</Address>
		<City>Jakarta</City>
		<PostalCode>WX1 6LT</PostalCode>
		<Country>UK</Country>
		<Phone>(171) 555-2282</Phone>
		<Fax>(171) 555-9199</Fax>
		<Pin>123</Pin>
		<SalesID>Yahya</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>YH</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>SPIMII</CustomerID>
		<CompanyName>Sogo PIM II</CompanyName>
		<ContactName>Susi</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Pondok Indah Raya</Address>
		<City>Jakarta</City>
		<PostalCode>1675</PostalCode>
		<Country>Portugal</Country>
		<Phone>(1) 354-2534</Phone>
		<Fax>(1) 354-2535</Fax>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>YH</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>SPS</CustomerID>
		<CompanyName>Sogo Plaza Senayan</CompanyName>
		<ContactName>Indra</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Asia Afrika</Address>
		<City>Jakarta</City>
		<PostalCode>08022</PostalCode>
		<Country>Spain</Country>
		<Phone>(93) 203 4560</Phone>
		<Fax>(93) 203 4561</Fax>
		<Pin>123</Pin>
		<SalesID>Yahya</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>YH</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>SPI</CustomerID>
		<CompanyName>Sogo Plaza Indonesia</CompanyName>
		<ContactName>Dwi</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Husni Thamrin </Address>
		<City>Jakarta</City>
		<PostalCode>41101</PostalCode>
		<Country>Spain</Country>
		<Phone>(95) 555 82 82</Phone>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>ALI</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>GMTA</CustomerID>
		<CompanyName>Galeria Matahari Taman Anggrek</CompanyName>
		<ContactName>Adi </ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Grogol Raya</Address>
		<City>Jakarta</City>
		<Region>Nueva Esparta</Region>
		<PostalCode>4980</PostalCode>
		<Country>Venezuela</Country>
		<Phone>(8) 34-56-12</Phone>
		<Fax>(8) 34-93-93</Fax>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>ALI</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>MSTS</CustomerID>
		<CompanyName>Matahari Segi Tiga Senen</CompanyName>
		<ContactName>Gunawan</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Senen Raya</Address>
		<City>Jakarta</City>
		<Region>OR</Region>
		<PostalCode>97219</PostalCode>
		<Country>USA</Country>
		<Phone>(503) 555-9573</Phone>
		<Fax>(503) 555-9646</Fax>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>ALI</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>MCJ</CustomerID>
		<CompanyName>Matahari Cibubur Junction</CompanyName>
		<ContactName>Sari</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Akses Cibubur</Address>
		<City>Jakarta</City>
		<PostalCode>1010</PostalCode>
		<Country>Argentina</Country>
		<Phone>(1) 123-5555</Phone>
		<Fax>(1) 123-5556</Fax>
		<Pin>123</Pin>
		<SalesID>ALI</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>YH</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>CPM</CustomerID>
		<CompanyName>Centro Plaza Semanggi</CompanyName>
		<ContactName>Permata</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Jendral Sudirman</Address>
		<City>Jakarta</City>
		<PostalCode>B-6000</PostalCode>
		<Country>Belgium</Country>
		<Phone>(071) 23 67 22 20</Phone>
		<Fax>(071) 23 67 22 21</Fax>
		<Pin>123</Pin>
		<SalesID>Yahya</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>ALI</SelesmanID>
	</Customers>
	<Customers>
		<CustomerID>CMC</CustomerID>
		<CompanyName>Centro Margo City</CompanyName>
		<ContactName>Shinta</ContactName>
		<ContactTitle>Manager Area</ContactTitle>
		<Address>Margonda Raya</Address>
		<City>Jakarta</City>
		<PostalCode>01-012</PostalCode>
		<Country>Poland</Country>
		<Phone>(26) 642-7012</Phone>
		<Fax>(26) 642-7012</Fax>
		<Pin>123</Pin>
		<SalesID>Manto</SalesID>
		<StsKunjugan>false</StsKunjugan>
		<SelesmanID>ALI</SelesmanID>
	</Customers>
	
</Inventory>
my code on vb :

VB Code:
  1. Sub SetData()
  2.         Try
  3.             Cursor.Current = Cursors.WaitCursor
  4.             Dim tblcust As DataTable
  5.             Dim tblcust2 As DataTable
  6.             Dim dvmcust As New DataViewManager(dsInv)
  7.             Dim dvcust As DataView
  8.             Dim drcust As DataRow
  9.             Dim tblcustDesc As DataTable
  10.             Dim dvCust2 As DataView
  11.          
  12.             tblcust = dsInv.Tables("Customers")
  13.            
  14.             dvmcust.DataViewSettings(tblcust).RowFilter = _
  15.             "SalesmanID='YH'"
  16.             dvcust = dvmcust.CreateDataView(tblcust)
  17.          
  18.             dg.DataSource = tblcust2
  19.         Catch ex As Exception
  20.         Finally
  21.             Cursor.Current = Cursors.Default
  22.         End Try
  23.     End Sub

I want to filter SalesmanID ='YH' but when i run this code data not filter.

1. what is wrong with my code ?
2. How to create Query on Xml FIle, if we have one more table on xml file ?
Tengkorak is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic .NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:06 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.