I am confusing here.
I already have my schema (named myMappingSchema.xdr as my
example) so I don't want to create schema. Also, I have
data in the database. I want to display my data as the
format in my schema (refer to my output from VB as below).
If I use WriteXml, all I got are elements, I do not see
attributes.
Alan
====================
<OrderHeader OrderTrackNumber="1011">
<PermitInfo EPermitNumber="E03-00017" City="Mercer
Island" ApplicationDate="2003-09-16"
TypeOfPermit="Plumbing" PermitInfoOccupancyType="Single
Family" TypeOfWork="Replacement" FairMarketValue="0"
ChargedAmount="106" VeriSignDcapTransNumber="V63F34666666"
VeriSignDcapTransDate="2003-09-16T13:30:21" />
<ApplicantInfo ApplicantFirstName="*"
ApplicantLastName="alan inc" ApplicantHouseNumber="111"
ApplicantStreetNumber="alan street"
ApplicantApartmentorSuiteNumber=""
ApplicantCity="Bellevue" ApplicantState="wa"
ApplicantZip="98888" ApplicantPhoneNumber="111-222-3333"
ApplicantPhoneNumberExtension=""
ApplicantEmailAddress="abc@yahoo.com" />
<ContractorInfo ContractorFirstName=""
ContractorLastName="" ContractorCompanyName="alan inc"
ContractorHouseNumber="111" ContractorStreetNumber="alan
street" ContractorApartmentorSuiteNumber=""
ContractorCity="Bellevue" ContractorState="wa"
ContractorZip="98888" ContractorPhoneNumber="111-222-3333"
ContractorPhoneNumberExtension=""
ContractorStateLicenseNumber="S1234"
ContractorLicenseExpirationDate="2005-12-31"
ContractorEmailAddress="abc@yahoo.com" />
<JobAddressInfo JobSiteHouseNumber="2021"
JobSiteStreetNumber="FABEN DR" JobSiteCity="Mercer Island"
JobSiteZip="98040" JobSiteCountyParcelNumber="2439700015"
JobSiteAssociatedBuildingPermitNumber=""
JobSiteFloorNumber="" JobSiteSuiteNumber=""
JobSiteTenantName="" JobSiteAdditionalInformation="" />
<OwnerInfo OwnerFirstName="House" OwnerLastName="Harvey"
OwnerCompanyName="" OwnerHouseNumber="2021"
OwnerStreetNumber="FABEN DR"
OwnerApartmentorSuiteNumber="" OwnerCity="Mercer Island"
OwnerState="WA" OwnerZip="98040" OwnerPhoneNumber=""
OwnerPhoneNumberExtension="" OwnerEmailAddress="" />
<BillToAddress BillToFirstName="alanfirst"
BillToLastName="vulast" BillToAddressLine1="111"
BillToAddressLine2="Main Street" BillToCity="Bellevue"
BillToState="WA" BillToZip="98008" />
<LineItems>
<Fixture Sku="MI_PLUM_1104" Name="Bath Tub"
Description="Bath Tub" Quantity="1" UnitPrice="9.8"
TotalPrice="9.8" />
<Fixture Sku="MI_PLUM_1106" Name="Bathroom Sink"
Description="Bathroom Sink" Quantity="1" UnitPrice="9.8"
TotalPrice="9.8" />
<Fixture Sku="MI_PLUM_9999" Name="Plumbing Issuance Fee"
Description="Plumbing Permit Issuance Fee" Quantity="1"
UnitPrice="23.5" TotalPrice="23.5" />
</LineItems>
</OrderHeader>
=====================
[quoted text, click to view] >-----Original Message-----
>Hi Alan,
>
>In the KB article, there's a link which points to the
VB .NET version of
>it. The following is the link:
>
>
http://support.microsoft.com/default.aspx?scid=kb;EN- US;301111
>
>Based on my understanding, you need to get the schema of
a table in XML. In
>ADO .NET, we use FillSchema() and WriteXmlSchema() to
achieve this. Here's
>an example:
>
> SqlDataAdapter sda = new
SqlDataAdapter("SELECT * FROM Employees",
>this.sqlConnection1);
> sda.FillSchema(ds,
SchemaType.Source);
> ds.WriteXmlSchema(@"c:\sch.xml");
>
>You can also write the xml schema to an XmlWriter object.
For more
>information, please refer to the following link:
>
>
http://msdn.microsoft.com/library/default.asp? url=/library/en-us/cpref/html/
>frlrfsystemdatadatasetclasswritexmltopic1.asp
>
>If anything is unclear, please feel free to reply to the
post.
>
>Kevin Yu
>=======
>"This posting is provided "AS IS" with no warranties, and
confers no
>rights."
>
>--------------------
>| Content-Class: urn:content-classes:message
>| From: "Alan" <nospam@nowhere.com>
>| Sender: "Alan" <nospam@nowhere.com>
>| Subject: Ado and Xpath vs. Ado.Net and XML
>| Date: Thu, 13 Nov 2003 08:00:28 -0800
>| Lines: 52
>| Message-ID: <32fe01c3a9ff$41e86610$a601280a@phx.gbl>
>| MIME-Version: 1.0
>| Content-Type: text/plain;
>| charset="iso-8859-1"
>| Content-Transfer-Encoding: 7bit
>| X-Newsreader: Microsoft CDO for Windows 2000
>| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>| Thread-Index: AcOp/0Hoi61NQCb/S2ux/Z4O6M6QHQ==
>| Newsgroups: microsoft.public.dotnet.xml
>| Path: cpmsftngxa06.phx.gbl
>| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.xml:17196
>| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
>| X-Tomcat-NG: microsoft.public.dotnet.xml
>|
>| I am a newbie to Ado.Net.
>| I am trying to convert my code to ado.net but I could
not
>| find equivalence. Could someone out there shed me a
light.
>|
>| I had data in DB, I created a schema, retrieved data
from
>| Db based on the schema and display data in the same
format
>| as schema.
>|
>| I did that successfully with XPath Query in (old)
Visual
>| Basic but not with Ado.Net and VB.Net. (More
explanation
>| about this in MS knowledge Base article 271619)
>|
>| Thank you
>|
>| ========================================
>| Const DBGUID_XPATH As String = "{ec2a4293-e898-11d2-
b1b7-
>| 00c04f680c56}"
>|
>| Dim DbConn As New ADODB.Connection
>| Dim dbCmd As ADODB.Command
>| Dim dbStream As ADODB.Stream
>| ' create db connection
>| Set DbConn = New ADODB.Connection
>| DbConn.ConnectionString = "mydbconnectionstring"
>| DbConn.Open
>|
>| Set dbCmd = New ADODB.Command
>| Set dbCmd.ActiveConnection = DbConn
>| Set dbStream = New ADODB.Stream
>| dbStream.Open
>| dbStream.LineSeparator = adCRLF
>|
>| ' set the command type to an XPath query
>| dbCmd.Dialect = DBGUID_XPATH
>| ' set the file name for the mapping schema
>| dbCmd.Properties("Mapping Schema")
>| = "myMappingSchema.xdr"
>| ' hook up the command to the result stream
>| dbCmd.Properties("Output Stream") = dbStream
>| ' Set search path
>| txtXPath = "myOrderItem"
>| ' set the actual text for the XPath command
>| dbCmd.CommandText = txtXPath
>|
>| ' execute the command stream
>| dbCmd.Execute , , adExecuteStream
>|
>| ' reset the stream's position in order to read it
>| dbStream.Position = 0
>|
>| ' set the displayed results to the command's
output
>| txtResult = dbStream.ReadText
>|
>
>.