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

DataSet.WriteXml refuses to write...

P: n/a
Hi NG,

I have no idea why, but since a while a dataset refuses to write to a
specific xml file.
I get the error message "Der Zugriff auf den Pfad
D:\VS2005Projects\BfpNet\BfpNet\bin\Debug\Bfp.xml wurde verweigert" which
translates to:
"The access to the path D:\VS...... was denied".

The dataset can read from this Bfp.xml without any problems.
The file has no read only flag set or any thing else I can identify as a
cause to this problem.
If I read the xml, set a breakpoint shortly before I write to it again,
delete the file, ds.WriteXml works fine from then on. Now I can start/stop
my app and modify the xml, read write it as often as I want, I have no more
problems.

So why cant I write to the original xml?

Thanks for hints and help.

Regards
Rainer Queck
Sep 19 '07 #1
Share this Question
Share on Google+
12 Replies


P: n/a
On Sep 19, 1:50 pm, "Rainer Queck" <Rai...@noemail.noemailwrote:

<snip>
So why cant I write to the original xml?
Sounds like you might still have the file open for reading. What
happens if you write to a different file (in the same directory) out
of interest? Or write to the file with an empty dataset (i.e. not
having read from it)?

Jon

Sep 19 '07 #2

P: n/a
Rainer Queck wrote:
Hi NG,

I have no idea why, but since a while a dataset refuses to write to a
specific xml file.
I get the error message "Der Zugriff auf den Pfad
D:\VS2005Projects\BfpNet\BfpNet\bin\Debug\Bfp.xml wurde verweigert" which
translates to:
"The access to the path D:\VS...... was denied".

The dataset can read from this Bfp.xml without any problems.
The file has no read only flag set or any thing else I can identify as a
cause to this problem.
If I read the xml, set a breakpoint shortly before I write to it again,
delete the file, ds.WriteXml works fine from then on. Now I can start/stop
my app and modify the xml, read write it as often as I want, I have no more
problems.

So why cant I write to the original xml?
Are the following true?

- The file is not currently in use/locked by some other (or the same)
application.
- The user trying to write to xml file has permissions to write to it.
- The path in the error message is correct.
Chris.
Sep 19 '07 #3

P: n/a
Perhaps the reference to the original file is still 'locked' because it
hasn't been garbage collected yet? Do you need to call .Dispose() on the
file?

Perhaps post your code?

"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:eo******************@TK2MSFTNGP04.phx.gbl...
Hi NG,

I have no idea why, but since a while a dataset refuses to write to a
specific xml file.
I get the error message "Der Zugriff auf den Pfad
D:\VS2005Projects\BfpNet\BfpNet\bin\Debug\Bfp.xml wurde verweigert" which
translates to:
"The access to the path D:\VS...... was denied".

The dataset can read from this Bfp.xml without any problems.
The file has no read only flag set or any thing else I can identify as a
cause to this problem.
If I read the xml, set a breakpoint shortly before I write to it again,
delete the file, ds.WriteXml works fine from then on. Now I can start/stop
my app and modify the xml, read write it as often as I want, I have no
more problems.

So why cant I write to the original xml?

Thanks for hints and help.

Regards
Rainer Queck


Sep 19 '07 #4

P: n/a
Hi Jon,
Sounds like you might still have the file open for reading. What
happens if you write to a different file (in the same directory) out
of interest? Or write to the file with an empty dataset (i.e. not
having read from it)?
This is what I ment (and did) as I wrote :
>==
If I read the xml, set a breakpoint shortly before I write to it again,
delete the file, ds.WriteXml works fine from then on. Now I can start/stop
my app and modify the xml, read write it as often as I want, I have no more
problems.
<==
I can create me a new Bfp.xml, and have no more problems with reading and
writing to it.

Regards
Rainer
Sep 19 '07 #5

P: n/a
Hi Chris,

"Chris Shepherd" <ch**@nospam.chsh.caschrieb im Newsbeitrag
news:OV****************@TK2MSFTNGP04.phx.gbl...
Are the following true?

- The file is not currently in use/locked by some other (or the same)
application.
Yes. If I delete the old bfp.xml and create me a new one, I have no more
problems with it.
- The user trying to write to xml file has permissions to write to it.
This is the big question. How can I find out?
- The path in the error message is correct.
Yes.

Regards
Rainer
Sep 19 '07 #6

P: n/a
Perhaps the reference to the original file is still 'locked' because it
hasn't been garbage collected yet? Do you need to call .Dispose() on the
file?
That would not explain, why it works, if I create me a new Bfp.xml and use
that from then on, because if I do so my problems are gone.
Perhaps post your code?
Difficult, because too much.
But I am only using <DataSet>.ReadXml and <DataSet>.WriteXml to acces the
xml file.

Regards
Rainer
>
"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:eo******************@TK2MSFTNGP04.phx.gbl...
>Hi NG,

I have no idea why, but since a while a dataset refuses to write to a
specific xml file.
I get the error message "Der Zugriff auf den Pfad
D:\VS2005Projects\BfpNet\BfpNet\bin\Debug\Bfp.x ml wurde verweigert" which
translates to:
"The access to the path D:\VS...... was denied".

The dataset can read from this Bfp.xml without any problems.
The file has no read only flag set or any thing else I can identify as a
cause to this problem.
If I read the xml, set a breakpoint shortly before I write to it again,
delete the file, ds.WriteXml works fine from then on. Now I can
start/stop my app and modify the xml, read write it as often as I want, I
have no more problems.

So why cant I write to the original xml?

Thanks for hints and help.

Regards
Rainer Queck



Sep 19 '07 #7

P: n/a
Rainer Queck wrote:
Hi Chris,

"Chris Shepherd" <ch**@nospam.chsh.caschrieb im Newsbeitrag
news:OV****************@TK2MSFTNGP04.phx.gbl...
>Are the following true?

- The file is not currently in use/locked by some other (or the same)
application.
Yes. If I delete the old bfp.xml and create me a new one, I have no more
problems with it.
>- The user trying to write to xml file has permissions to write to it.
This is the big question. How can I find out?
Right click the file, go Properties, and then look at the Security tab.
This is assuming Windows XP Professional, Windows 2000 (any), Windows
2003, or Windows Vista.

Chris.
Sep 19 '07 #8

P: n/a
there is no security tab.
FYI I am working with XP-Professional.
I know the security can be set "some where", but where?

Regards
Rainer

"Chris Shepherd" <ch**@nospam.chsh.caschrieb im Newsbeitrag
news:eY****************@TK2MSFTNGP02.phx.gbl...
Rainer Queck wrote:
>Hi Chris,

"Chris Shepherd" <ch**@nospam.chsh.caschrieb im Newsbeitrag
news:OV****************@TK2MSFTNGP04.phx.gbl...
>>Are the following true?

- The file is not currently in use/locked by some other (or the same)
application.
Yes. If I delete the old bfp.xml and create me a new one, I have no more
problems with it.
>>- The user trying to write to xml file has permissions to write to it.
This is the big question. How can I find out?

Right click the file, go Properties, and then look at the Security tab.
This is assuming Windows XP Professional, Windows 2000 (any), Windows
2003, or Windows Vista.

Chris.

Sep 19 '07 #9

P: n/a
On Sep 19, 2:08 pm, "Rainer Queck" <Rai...@noemail.noemailwrote:
Sounds like you might still have the file open for reading. What
happens if you write to a different file (in the same directory) out
of interest? Or write to the file with an empty dataset (i.e. not
having read from it)?

This is what I ment (and did) as I wrote :
==

If I read the xml, set a breakpoint shortly before I write to it again,
delete the file, ds.WriteXml works fine from then on. Now I can start/stop
my app and modify the xml, read write it as often as I want, I have no more
problems.
<==
I can create me a new Bfp.xml, and have no more problems with reading and
writing to it.
So how do you get back from that situation to having problems again?

Jon

Sep 19 '07 #10

P: n/a
Hi Jon,

"Jon Skeet [C# MVP]" <sk***@pobox.comschrieb im Newsbeitrag
news:11**********************@r29g2000hsg.googlegr oups.com...
>I can create me a new Bfp.xml, and have no more problems with reading and
writing to it.

So how do you get back from that situation to having problems again?
By reverting the SnapShot off my VMWare virtual machine ;-)

To be honest, I cant get back to the problem state now unless I do a revert
of my snapshot.
The problem is solved if I create a new bfp.xml. But it worries me, that
this can happen later on, when one of my customers will use the software.
That is why I want to locate the cause to my problem.

Regards
Rainer
Sep 19 '07 #11

P: n/a
Rainer Queck <Ra****@noemail.noemailwrote:
"Jon Skeet [C# MVP]" <sk***@pobox.comschrieb im Newsbeitrag
news:11**********************@r29g2000hsg.googlegr oups.com...
I can create me a new Bfp.xml, and have no more problems with reading and
writing to it.
So how do you get back from that situation to having problems again?
By reverting the SnapShot off my VMWare virtual machine ;-)

To be honest, I cant get back to the problem state now unless I do a revert
of my snapshot.
The problem is solved if I create a new bfp.xml. But it worries me, that
this can happen later on, when one of my customers will use the software.
That is why I want to locate the cause to my problem.
That sounds like it's a permissions issue then.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 19 '07 #12

P: n/a
Hi Rainer,

I would suggest to use Process Monitor
(http://www.microsoft.com/technet/sys...eads/processmo
nitor.mspx) or FileMon
(http://www.microsoft.com/technet/sys...k/Filemon.mspx) to
monitor the xml file and see if any other processes are accessing it too.

I'm not sure if it's related to ds.ReadXml(), but you could create a copy
of the xml first and call ds.ReadXml() on the copy; later call
ds.WriteXml() on the original one. This could isolate if the issue is
related to ReadXml() or not.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 20 '07 #13

This discussion thread is closed

Replies have been disabled for this discussion.