473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to save the XML file into the database

Dear ASP.NET Programmers,

I am saving the tables of a dataset into an XML file. I want to save the XML
file into the database, then retireve it as a dataset. I use the following
code:

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

where ds is my dataset.

When the page loads, I want that the contents of the XML file are loaded
into a dataset. I hope, that I could clearly explain what I want. Thanks in
advance,

Buran
Nov 19 '05 #1
2 1875
If you're storing and retrieving XML in a database, you might want to review
this article:

A Survey of Microsoft SQL Server 2000 XML Features

http://msdn.microsoft.com/library/de...ml07162001.asp

"buran" <b@b.com> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl...
Dear ASP.NET Programmers,

I am saving the tables of a dataset into an XML file. I want to save the
XML
file into the database, then retireve it as a dataset. I use the following
code:

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

where ds is my dataset.

When the page loads, I want that the contents of the XML file are loaded
into a dataset. I hope, that I could clearly explain what I want. Thanks
in
advance,

Buran

Nov 19 '05 #2
Hi,

First of all, thank you for your help. I think, 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.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

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:

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

'on another page

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()

How can I solve this? Thanks in advance,

Buran

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:e3**************@tk2msftngp13.phx.gbl...
If you're storing and retrieving XML in a database, you might want to review this article:

A Survey of Microsoft SQL Server 2000 XML Features

http://msdn.microsoft.com/library/de...ml07162001.asp
"buran" <b@b.com> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl...
Dear ASP.NET Programmers,

I am saving the tables of a dataset into an XML file. I want to save the
XML
file into the database, then retireve it as a dataset. I use the following code:

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

where ds is my dataset.

When the page loads, I want that the contents of the XML file are loaded
into a dataset. I hope, that I could clearly explain what I want. Thanks in
advance,

Buran


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
2
by: KathyB | last post by:
One more question...please. I have an xml doc like this: <assembly> <station name="station1"> <wi id="1" name="doc231"> <boards> <board sn="1111" start="07/15/03" end="07/16/03" /> <board...
5
by: Carl | last post by:
Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents". We have had...
7
by: Shanli RICHEZ | last post by:
I'm using ASP.NET and quite a lot of object in memory instead of a database. The question is that I tried to save the data, serialize them in a XML file to save them when the application is...
4
by: kev | last post by:
Hi folks, I have created a database to store information on equipments. During the first level of registration, there is a form that i need the user to fill up details on the equipment testing....
6
by: Josetta | last post by:
Access 2003 I've been experiencing some problems with my "monster" database the last couple of days. I imported all objects into a new database yesterday, which pretty much stopped the crashing...
2
by: chike_oji | last post by:
Please can someone help me. I am writing a web application, that allows for the upload of an excel sheet into the database. I have an upload button and a save button. The upload button allows...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
3
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
2
by: simonyong | last post by:
Hello, anyone I had search for few days with how to save file when user choose a file name from listbox and i will search the file from database and user can save it into their desktop what I had...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.