xml, dataset, datalist

B

buran

Dear ASP.NET Programmers,

I need your help on the following case:
1. I have a page coverpage.aspx, on which I load invoice data into the
datalist control dliHospCosts. I use the stored procedure spGetHospAmounts
and load the data.

<ItemTemplate>
<TABLE id="Table77" width="100%">
<TR>
<td align="left" width="7%" valign="top">
<asp:button id="btnEditItemHosp" runat="server" Text="Edit"
CommandName="edit"></asp:button>&nbsp;
<asp:LinkButton id="lnkDeleteItemHosp" runat="server"
CausesValidation="False" CommandName="delete">Delete</asp:LinkButton></td>
<TD align="left">
<UL>
<LI>
<%# Databinder.Eval(Container, "DataItem.SPName") %>
</LI>
</UL>
</TD>
<TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.InvoiceNo") %></TD>
<TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.InvoiceDate", "{0:d}") %></TD>
<TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.ExchangeRate") %></TD>
<TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.WithoutUs", "{0:n}") %></TD>
<TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.Difference", "{0:n}") %></TD>
<TD align="right" width="10%" bgcolor="Gainsboro"><%#
Databinder.Eval(Container, "DataItem.InvoiceAmount", "{0:n}") %></TD>
</TR>
</TABLE>
</ItemTemplate>

2. I get XML string from the dataset ds and save it into a file burak.xml
and into the database as ntext.

ds.WriteXml("C:\Inetpub\wwwroot\database2\richtext\burak.xml")

Dim strXML As String

strXML = ds.GetXml

strSql = "spNewCoverPage"

myCommand.CommandText = strSql

myCommand.CommandType = CommandType.StoredProcedure

myCommand.Parameters.Clear()

myCommand.Parameters.Add("@ourFileNo", Session("selectedFileNumber"))

myCommand.Parameters.Add("@xMLData", strXML)

..

..

3. Following is the contents of the burak.xml: This is also saved in the
database as ntext.

<?xml version="1.0" standalone="yes" ?>

- <NewDataSet>
- <OtherCosts>
<ActionDesc>Airplane Ticket Arrangement</ActionDesc>
<InPrice>548</InPrice>
<InPriceCur>EUR</InPriceCur>
<OutPrice>630</OutPrice>
<OutPriceCur>EUR</OutPriceCur>
<ActionTypeID>6</ActionTypeID>
<ActionID>1001</ActionID>
</OtherCosts>
- <OtherCosts>
<ActionDesc>Airplane Ticket Arrangement</ActionDesc>
<InPrice>442</InPrice>
<InPriceCur>EUR</InPriceCur>
<OutPrice>543</OutPrice>
<OutPriceCur>EUR</OutPriceCur>
<ActionTypeID>6</ActionTypeID>
<ActionID>1003</ActionID>
</OtherCosts>
- <OtherCosts>
<ActionDesc>Ground Ambulance</ActionDesc>
<InPrice>108</InPrice>
<InPriceCur>EUR</InPriceCur>
<OutPrice>200</OutPrice>
<OutPriceCur>EUR</OutPriceCur>
<ActionTypeID>1</ActionTypeID>
<ActionID>1005</ActionID>
</OtherCosts>
- <OtherCosts>
<ActionDesc>Hotel Reservation</ActionDesc>
<InPrice>20</InPrice>
<InPriceCur>YTL</InPriceCur>
<OutPrice>30</OutPrice>
<OutPriceCur>EUR</OutPriceCur>
<ActionTypeID>9</ActionTypeID>
<ActionID>1006</ActionID>
</OtherCosts>
</NewDataSet>

4. I want to load the XML string from the database into the datalist control
dliHospCosts (same as the one on the coverpage.aspx) on another page
coverpage_generated.aspx. Since, the XML does not have a tag named
ExchangeRate (beacuse it was null), I receive the following error:

DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with
the name ExchangeRate

I hope that I could explain my problem. Thanks in advance,

Buran
 
B

buran

Oops, I pasted the wrong XML. The correct one should be the following:

<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
- <HospCosts>
<InvoiceAmount>483.2400</InvoiceAmount>
<CurrencyOriginal>EUR</CurrencyOriginal>
<OurFileNo>M05000199</OurFileNo>
<SPName>BÝLGÝ HASTANESÝ</SPName>
<InvoiceDate>2005-04-11T00:00:00.0000000+03:00</InvoiceDate>
<InvoiceNo>037029</InvoiceNo>
<WithoutUs>589.9400</WithoutUs>
<Difference>106.7000</Difference>
</HospCosts>
</NewDataSet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top