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 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.
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
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
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.
> 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")
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...? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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,...
|
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...
|
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...
|
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: 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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |