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. Advertisements

  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. Advertisements

  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. Advertisements

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. jkflens
    Replies:
    2
    Views:
    1,718
    jkflens
    May 30, 2006
  2. Mike

    read and update XML file

    Mike, Jul 14, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    398
  3. Sreejith K
    Replies:
    24
    Views:
    1,432
    Sreejith K
    Mar 24, 2009
  4. siaj

    Read\Update XML file

    siaj, Feb 17, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    176
    Lionel LASKE
    Feb 18, 2005
  5. Christopher Aldridge
    Replies:
    0
    Views:
    218
    Christopher Aldridge
    Aug 9, 2005
  6. Sniper Abandon
    Replies:
    3
    Views:
    392
    Robert Klemme
    Nov 19, 2009
  7. Alex Dowad
    Replies:
    4
    Views:
    645
    Michel Demazure
    May 1, 2010
  8. Erik Wasser
    Replies:
    5
    Views:
    816
    Peter J. Holzer
    Mar 5, 2006
Loading...