Read\update xml file

Discussion in 'ASP .Net' started by =?Utf-8?B?c2lhag==?=, Feb 17, 2005.

  1. 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
     
    =?Utf-8?B?c2lhag==?=, Feb 17, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?c2lhag==?=

    ashish Guest

    siaj wrote:

    > 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.
     
    ashish, Feb 17, 2005
    #2
    1. Advertising

  3. thanks Ashish...
    u were right ..It worked ..
    cheers,
    siaj

    "ashish" wrote:

    > siaj wrote:
    >
    > > 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.
    >
    >
     
    =?Utf-8?B?c2lhag==?=, Feb 17, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike

    read and update XML file

    Mike, Jul 14, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    342
  2. siaj

    Read\Update XML file

    siaj, Feb 17, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    113
    Lionel LASKE
    Feb 18, 2005
  3. Christopher Aldridge
    Replies:
    0
    Views:
    126
    Christopher Aldridge
    Aug 9, 2005
  4. Alex Dowad
    Replies:
    4
    Views:
    283
    Michel Demazure
    May 1, 2010
  5. Erik Wasser
    Replies:
    5
    Views:
    479
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page