binding XML data to the datalist control

B

buran

Hi,

I managed to save the XML data into the database and retrieve it from the
database. I have the following problem. When I bind the XML data, which I
have read from the database, to the datalist control, following error
message appears:


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

Source Error:


Line 89: <TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.InvoiceNo") %></TD>
Line 90: <TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.InvoiceDate", "{0:d}") %></TD>
Line 91: <TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.ExchangeRate") %></TD>
Line 92: <TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.WithoutUs", "{0:n}") %></TD>
Line 93: <TD align="right" width="10%"><%# Databinder.Eval(Container,
"DataItem.Difference", "{0:n}") %></TD>

I am using the following code blocks:

Dim strXML As String
strXML = myDataSet.Tables(0).Rows(0).Item("XMLData")

Dim strReader As System.IO.StringReader
strReader = New System.IO.StringReader(strXML)

ds.ReadXml(strReader)

dliHospCosts.DataSource = ds
dliHospCosts.DataMember = "HospCosts"
dliHospCosts.DataBind()



I am using the following code snippet to save the XML data as text into the
database:



Private Sub btnSaveCP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSaveCP.Click

ds = ViewState("ds")
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)
myCommand.Parameters.Add("@totalAmount", CalculateTotalAmount())
myCommand.Parameters.Add("@totalAmountCurrency", lblCurTotal.Text)
myCommand.Parameters.Add("@createdOn", Date.Now)
myCommand.Parameters.Add("@createdBy", Session("employeeId"))
'Girilen yazýlarý da kaydedelim
myCommand.Parameters.Add("@enteredICAddress",
Server.UrlEncode(txtICAddress.Text))
myCommand.Parameters.Add("@enteredClientName", txtClientName.Text)
If Request.Form.Get("txtItemDesc") <> "" Then
myCommand.Parameters.Add("@enteredItemDesc",
Request.Form.Get("txtItemDesc"))
End If
If Request.Form.Get("txtItem") <> "" Then
myCommand.Parameters.Add("@enteredItem",
Request.Form.Get("txtItem"))
End If
myCommand.Parameters.Add("@enteredDate", CType(txtDate.Text, Date))

myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()

End Sub





How can I solve this? Thanks in advance,

Buran
 

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

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top