473,503 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can only write to root of disk

I am having a problem writing to an Access database. It only seems to work if the database is placed in c:\
Retrieving records from it is no problem when it is placed in a subdirectory of mapppath, but writing to it is impossible (unless I put it in c:\).

This is the code that refuses to work:
Dim myConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MapPath("db\users.mdb") & ";Jet OLEDB:Database Password=123;"

This is the code that works for me:
Dim myConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\users.mdb" & ";Jet OLEDB:Database Password=nt2123;"

The mappath dir and the \db dir as well as the database file itself have read and write permissions.

Why does it not work???
--
Eric J. van Dorp
VanDorp Educatief
www.vandorp.net
Nov 18 '05 #1
6 1273
"Eric J." <Er***@discussions.microsoft.com> wrote in message
news:86**********************************@microsof t.com...
.. . .
This is the code that refuses to work:
Dim myConString As String _
= "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & MapPath("db\users.mdb") & ";" _
& "Jet OLEDB:Database Password=123;"
Looks like you're written your own MapPath function (usually
provided by the Server object?) or you have On Error Resume Next
work against you.

Perhaps this might work better :
Dim myConString As String _
= "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("/db/users.mdb") & ";" _
& "Jet OLEDB:Database Password=123;"


HTH,
Phill W.
Nov 18 '05 #2
Jos
Phill. W wrote:
"Eric J." <Er***@discussions.microsoft.com> wrote in message
news:86**********************************@microsof t.com...
. . .
This is the code that refuses to work:
Dim myConString As String _
= "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & MapPath("db\users.mdb") & ";" _
& "Jet OLEDB:Database Password=123;"


Looks like you're written your own MapPath function (usually
provided by the Server object?) or you have On Error Resume Next
work against you.

Perhaps this might work better :
Dim myConString As String _
= "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("/db/users.mdb") & ";" _
& "Jet OLEDB:Database Password=123;"


HTH,
Phill W.


MapPath() is also a method of the Page object.

--

Jos
Nov 18 '05 #3
In addition to the suggestion you have already received in this group,
your ASPNET account may not have access to this folder. If the users are
able to access the folder, consider forcing authentication and using
impersonation. If not, you will have to give ASPNET access to the /db
folder.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Eric J." <Er***@discussions.microsoft.com> wrote in message
news:86**********************************@microsof t.com...
I am having a problem writing to an Access database. It only seems to work if the database is placed in c:\ Retrieving records from it is no problem when it is placed in a subdirectory of mapppath, but writing to it is impossible (unless I put it
in c:\).
This is the code that refuses to work:
Dim myConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MapPath("db\users.mdb") & ";Jet OLEDB:Database Password=123;"
This is the code that works for me:
Dim myConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\users.mdb" & ";Jet OLEDB:Database Password=nt2123;"
The mappath dir and the \db dir as well as the database file itself have read and write permissions.
Why does it not work???
--
Eric J. van Dorp
VanDorp Educatief
www.vandorp.net


Nov 18 '05 #4
Using XP, I take it.

By default, you do not have a security tab in XP. To turn this on, the drive
must be NTFS (if I remember correctly). Go to Windows Explorer and use Tools
Folder Options >> View. Now uncheck "Use Simple File Sharing". You should
now be able to set security correctly to allow ASPNET to work with it.

Since this is the ASP .NET group, I assume you are not using XP Home, which
does not allow you to turn off Simple File Sharing (perhaps a registry
hack?).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Eric J." <Er***@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
In addition to the suggestion you have already received in this group,
your ASPNET account may not have access to this folder. If the users are
able to access the folder, consider forcing authentication and using
impersonation. If not, you will have to give ASPNET access to the /db
folder.
I have set verification to Anonymous (IUSR) and read/write to true in the

ISS system tool. I have given read/write access to all users via the
security tab in Explorer. I only can't set the ' Read Only checkbox' in the
properties of the folder to False. It keeps changing back to True.
I have no idea how to move on from this.

Nov 18 '05 #5
> Using XP, I take it.

Yes, indeed

By default, you do not have a security tab in XP. To turn this on, the drive
must be NTFS (if I remember correctly). Go to Windows Explorer and use Tools
Folder Options >> View. Now uncheck "Use Simple File Sharing". You should

now be able to set security correctly to allow ASPNET to work with it.

Since this is the ASP .NET group, I assume you are not using XP Home, which
does not allow you to turn off Simple File Sharing (perhaps a registry
hack?).


No, XP Pro. I did all that. Gave read/write permission to everyone. Still no succes. If I change the connection string to the specified folder it works also ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\Totaal\db\users.mdb;Jet OLEDB:Database Password=2123). Just not when I am referring to the folder using MapPath. (DataSource=" & MapPath("db\users.mdb")
Nov 18 '05 #6
Found it!!

Changing to
Dim myConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("/db/users.mdb") & ";" _
& "Jet OLEDB:Database Password=123;"

does the trick. Thank you Phil and the rest. Why can't MS produce some better error messages...?
Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3578
by: gruddo | last post by:
Hi this is my first post. I have two webservers. I can run php code fine on one but not the other. Both webservers can read files only one can write. I have looked around at other posts and they...
18
6770
by: reclusive monkey | last post by:
Firstly is this possible?! I've been playing around with XML for various things, and it would be very helpful if I could manage to write to an XML file with no server-side work. The reason for...
1
2177
by: kavi81 | last post by:
Hi, I have written a c++ code which is a message queue. I have an Enqueue and a Dequeue. Here is the code for enqueue: ########################################################## Enqueue...
2
3090
by: jason hirst | last post by:
Hi, I've created a simple application that reads data from a SQL Server, and appends this to an XML file. The problem is, that the XML data structure seems to go to the top level when I write...
4
13761
by: Cheryl Gilbert | last post by:
I'm sending xml to a web service by building a string dynamically. When my web service tries to validate the xml with a schema, I'm getting the error "the root element is missing". If I use an xml...
2
5474
by: yxq | last post by:
Hello I want to create and delete the folder share, i found that it is ok for generic folder, but it does not work for Root directory(i.e c:\, d:\) The code...
5
5070
by: Sumana | last post by:
Hi All, We developed our project on VC++.Net console application to create image of disk and to write the image We are having problem with reading and writing the sector beyond 6GB Disk or...
6
2761
by: Hans | last post by:
Hello, I want to put logging functionality in my application and i want to store this information in an XML file with date, string and integer values. How do i write just one record to the XML...
2
8508
by: ECRIA | last post by:
Hi All, We are trying to figure out why PHP's file handling functions refuses to access the web root using the "/" character on our Windows machines. For example, a file /test.php is located in...
0
7205
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
7093
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
7287
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,...
1
7008
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
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
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,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.