Read\update xml file

G

Guest

Hi..
I m just trying to learn using XML file as a datastore.

I am reading a dataset from a XML file and then trying to update the XML
file with some changes in the dataset.
My code is as follwoing.

Private Sub ReadUpdateData()
Dim dsUser As New DataSet
dsUser.ReadXml(Server.MapPath("Datafiles\Users.xml"))
DataGrid1.DataSource = dsUser
DataGrid1.DataBind() 'Read data

dsUser.Tables(0).Rows(0).Item(1) = "xyz" 'changed value
dsUser.WriteXml(Server.MapPath("Datafiles\Users.xml"))
End Sub

The Above code gives me error as Access to the path
"C:\...\Datafiles\Users.xml" is denied


any help will be highly aprreciated.

Cheers,
siaj
 
A

ashish

siaj said:
Hi..
I m just trying to learn using XML file as a datastore.

I am reading a dataset from a XML file and then trying to update the XML
file with some changes in the dataset.
My code is as follwoing.

Private Sub ReadUpdateData()
Dim dsUser As New DataSet
dsUser.ReadXml(Server.MapPath("Datafiles\Users.xml"))
DataGrid1.DataSource = dsUser
DataGrid1.DataBind() 'Read data

dsUser.Tables(0).Rows(0).Item(1) = "xyz" 'changed value
dsUser.WriteXml(Server.MapPath("Datafiles\Users.xml"))
End Sub

The Above code gives me error as Access to the path
"C:\...\Datafiles\Users.xml" is denied


any help will be highly aprreciated.

Cheers,
siaj
make sure your xml file is having read persmission for aspnet user.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top