473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

DataSet.WriteXml refuses to write...

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
12 4226
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: DotNetJunkies User | last post by:
Hi all, I have a question on how can I write the entire Dataset to a NTEXT field of SQLServer. Can anyone help me? Thanks! /mike
4
by: Simon | last post by:
Hi all, I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset. The data set can contain 10's of tables, each with 100's of rows, and I have...
1
by: Rahul Agarwal | last post by:
Hi I am trying to write data back to the client using dataset.WriteXML and I have set the Thread.CurrentThread.CurrentCulture to "no" (norwegian) just before writing the data using WriteXML....
2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
3
by: Joe98765 | last post by:
I have data coming from SQL Server and need to write out some XML. I have a schema(xsd) for this XML file. Right now I am bringing in the DataSet and writing out the elements and attributes myself...
4
by: Wes | last post by:
Hello, I have an application using an xml dataset to store app and user settings. The problem I am having is related to writexml. I have a save button on my application that updates the dataset...
2
by: David Richards | last post by:
Hi, I was wondering if anyone could help me. I have DataSet that contains the following data tables Customers, Calls, Quotes, QuoteDetails, Competitors, Contacts, Notes, and I have setup...
6
by: Steven Nagy | last post by:
HI, This all applies to a project in the compact framework (Pocket PC). I need to convert a dataset object into XML which I will then send out via TCP. In a standard app I would do this as...
4
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a DataSet that I save as XML using the DataSet DataTable's WriteXml method. If I say XmlWriteMode.IgnoreSchema, it shows up great in Excel, but I can not reopen the file in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.