By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,278 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,278 IT Pros & Developers. It's quick & easy.

Reading/updating XML file

P: n/a
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.xm l"))
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,
Jai
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You probably have the file open in another window. Close it

Regards

"siaj" <si**@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
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.xm l"))
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,
Jai

Nov 21 '05 #2

P: n/a
No I dont Have the Xml file open anywhere .Althufh just fyi its a part of my
project.

Thanks

"Mr Newbie" wrote:
You probably have the file open in another window. Close it

Regards

"siaj" <si**@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
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.xm l"))
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,
Jai


Nov 21 '05 #3

P: n/a
OK, well this is normally caused by your code breaking and when you try to
run it again, there is a handle still open.

Reboot your PC and then step through the code to find the error.

"siaj" <si**@discussions.microsoft.com> wrote in message
news:60**********************************@microsof t.com...
No I dont Have the Xml file open anywhere .Althufh just fyi its a part of
my
project.

Thanks

"Mr Newbie" wrote:
You probably have the file open in another window. Close it

Regards

"siaj" <si**@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
> 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.xm l"))
> 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,
> Jai


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.