TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Feroz Khan
1.4k
300
91.9k
How to Read Xml in DataTable or DataSet
Jun 13 2018 9:03 PM
Hi,
I am trying to use read xml file in dataset but showing some error i want to read same file in dataset, can anyone help me for this.
below is my code..
XmlReader xmlFile;
xmlFile = XmlReader.Create(@
"C:\Users\Feroz\Desktop\xml Data\file.xml"
,
new
XmlReaderSettings());
DataSet ds =
new
DataSet(
"tbl"
);
ds.ReadXml(xmlFile);
int
i = 0;
for
(i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
MessageBox.Show(ds.Tables[0].Rows[i].ItemArray[2].ToString());
}
showing error - Column name 'lWorkstationNmbr' is defined for different mapping types.
xml file.
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
ITX_CLOSE_EXPORT
>
<
STORE_INFO
>
<
storeId
>
6644
</
storeId
>
<
closeDate
>
20180401
</
closeDate
>
<
sessionDateFrom
>
20180331
</
sessionDateFrom
>
<
sessionTimeFrom
>
220334
</
sessionTimeFrom
>
<
sessionDateTo
>
20180401
</
sessionDateTo
>
<
sessionTimeTo
>
221204
</
sessionTimeTo
>
<
version
>
3.5.4.1
</
version
>
</
STORE_INFO
>
<
VALID_TICKETS
>
-
<
SALE_LINE_ITEMS
>
-
<
ITEM
lTaNmbr
=
"2915"
lWorkstationNmbr
=
"1"
lRetailStoreId
=
"6644"
>
<
lRetailStoreID
>
6644
</
lRetailStoreID
>
<
lWorkstationNmbr
>
1
</
lWorkstationNmbr
>
<
lTaNmbr
>
2915
</
lTaNmbr
>
<
szItxOperationType
>
1
</
szItxOperationType
>
<
szItxSerial
>
S
</
szItxSerial
>
<
lItxCurrentValue
>
1367
</
lItxCurrentValue
>
<
szDate
>
20180401
</
szDate
>
<
szTime
>
112629
</
szTime
>
<
lOperatorID
>
11532
</
lOperatorID
>
<
lItxLineNmbr
>
1
</
lItxLineNmbr
>
<
szItemLookupCode
>
4844001370632
</
szItemLookupCode
>
<
lItxYear
>
2018
</
lItxYear
>
<
szItxCampaign
>
V
</
szItxCampaign
>
<
lItxFamilyCode
>
92
</
lItxFamilyCode
>
<
lItxSubFamilyCode
>
102
</
lItxSubFamilyCode
>
<
szItxPeriodDesc
>
S
</
szItxPeriodDesc
>
<
szMerchHierarchyLevelCode
>
1
</
szMerchHierarchyLevelCode
>
<
dTaQty
>
1.0000
</
dTaQty
>
<
dTaPrice
>
17.0000
</
dTaPrice
>
<
dOrgPrice
>
0.0000
</
dOrgPrice
>
<
dTaDiscount
>
0.0000
</
dTaDiscount
>
<
dItxTaxPercent
>
18.0000
</
dItxTaxPercent
>
<
bIsVoidReceiptSLI
>
0
</
bIsVoidReceiptSLI
>
<
szType
>
ART_SALE
</
szType
>
<
szTaType
>
SA
</
szTaType
>
<
lItxOriginalRetailStoreID
>
0
</
lItxOriginalRetailStoreID
>
<
lItxOriginalWorkstationNmbr
>
0
</
lItxOriginalWorkstationNmbr
>
<
lItxOriginalTaNmbr
>
0
</
lItxOriginalTaNmbr
>
<
lItxOriginalCurrentValue
>
0
</
lItxOriginalCurrentValue
>
<
szItxOriginalSerial
>
0
</
szItxOriginalSerial
>
<
szItxOriginalDate
>
0
</
szItxOriginalDate
>
<
szEmployeeNumber
>
-1
</
szEmployeeNumber
>
</
ITEM
>
Reply
Answers (
10
)
Populate datagridview column combobox datasource
How to add Datepicker in MVC