?
Solved

Read Write

Posted on 2009-04-24
7
Medium Priority
?
267 Views
Last Modified: 2012-05-06
I have an Access MDB file on a install disc which my install program copies to the users computer. Trouble is after its copied it ends up as Read only. What is the code for changing it to Read/Write
0
Comment
Question by:JeffvClayton
  • 4
  • 2
7 Comments
 
LVL 11

Expert Comment

by:bmatumbura
ID: 24224359
You can include a batch file that will also be installed by the installer which removes the read-only attribute when it is executed. The installer should run this batch file after copying the database. The contents of the batch file follow:
@ECHO off
attrib -r -h -s *.mdb

Open in new window

0
 
LVL 53

Expert Comment

by:Dhaest
ID: 24224379
To remove an attribute use System.IO.File.SetAttributes. Ex:

if(File.GetAttributes(savedCardFilePath) == FileAttributes.ReadOnly)
File.SetAttributes(savedCardFilePath, FileAttributes.Normal);
0
 
LVL 3

Author Comment

by:JeffvClayton
ID: 24224415
DHaest,

can you translate the above code to VB.Net?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 24224456
If File.GetAttributes(yourFileName) = FileAttributes.[ReadOnly] Then
    File.SetAttributes(yourFileName, FileAttributes.Normal)
End If
0
 
LVL 3

Author Comment

by:JeffvClayton
ID: 24224503
I alread tries that but GetAttributes is not a property of System.IO.FileInfo
0
 
LVL 3

Author Comment

by:JeffvClayton
ID: 24224519
Sorry I already used the word File as a System.IO.FileInfo variable
0
 
LVL 3

Author Comment

by:JeffvClayton
ID: 24224570
 If IO.File.GetAttributes(MyFile) = IO.FileAttributes.ReadOnly Then
             IO.File.SetAttributes(MyFile, IO.FileAttributes.Normal)
   End If
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question