Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 555
  • Last Modified:

Access to the path "C:\tmp" is denied running Visual C# Walkthrough: Reading XML Data into a Dataset

I am running the Visual C# .NET sample program - Visual C# Walkthrough: Reading XML Data into a Dataset, and getting the following error:
       An unhandled exception of type 'System.UnauthorizedAccessException' occurred in system.xml.dll
       Additional information: Access to the path "C:\tmp" is denied.
On the code lines:
      string filePath = "C:\\tmp";
      dsAuthors.ReadXml(filePath);

I have checked the attributes for C:\tmp  using command "attrib" and read only is not on.
I am logged in as Administrator.

What else should I look at?

                  
0
GaryHoff
Asked:
GaryHoff
1 Solution
 
AlexFMCommented:
string filePath = "C:\\tmp";

I think this should be some XML file, like:

string filePath = "C:\\tmp\\data.xml";
0
 
GaryHoffAuthor Commented:
That was it.  I thought the dataSource name was appended to the path - not so.
The path and filename are required.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now