Problem connecting to Access Database from ASP.NET Application

  • Thread starter Nathan Sokalski
  • Start date
N

Nathan Sokalski

I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE="
& Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not know
what the problem is. The error returned when I try to view the page in my
browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
+36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e)
in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my
connection string should look like? Thanks.
 
J

Juan T. Llibre

Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.
 
N

Nathan Sokalski

Thank you for that information, it was definitely an error that would have
caused me problems. However, I am now recieving the following error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot open
the file 'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is
already opened exclusively by another user, or you need permission to view
its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
+36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e)
in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is the
first thing I did after booting my computer). I tried looking at the
security tab in the properties of nathansokalski_com.mdb, but the only 2
accounts there were mine and SYSTEM (it did not list others like Internet
Guest Account, Launch IIS Process Account, VS Developers, etc.). It is
listed in Visual Studio as part of the Application. What do I need to do to
either the file or my code to be able to use the database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





Nathan Sokalski said:
I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE="
& Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not
know what the problem is. The error returned when I try to view the page
in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
+36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my
connection string should look like? Thanks.
 
J

Juan T. Llibre

Hi, Nathan.

Here's a short file you can use to determine
which account ASP.NET is running as :
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------

Run it, and it will tell you the name of the account you need to give read/write
permissions to, for the directory where your mdb file is located, so it's allowed
to read and write to the database.

Are you running a secured database ( username/password needed to read it ? )
Or just using the admin with no password ?





Nathan Sokalski said:
Thank you for that information, it was definitely an error that would have caused me
problems. However, I am now recieving the following error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file
'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is already opened
exclusively by another user, or you need permission to view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState&
originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is the first thing I
did after booting my computer). I tried looking at the security tab in the properties of
nathansokalski_com.mdb, but the only 2 accounts there were mine and SYSTEM (it did not
list others like Internet Guest Account, Launch IIS Process Account, VS Developers,
etc.). It is listed in Visual Studio as part of the Application. What do I need to do to
either the file or my code to be able to use the database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





Nathan Sokalski said:
I am trying to connect to a Microsoft Access Database from my ASP.NET Application. I
use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE=" &
Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not know what the
problem is. The error returned when I try to view the page in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my connection
string should look like? Thanks.
 
N

Nathan Sokalski

When I ran the code you gave me, the account it returned was NJS\ASPNET,
which is what I expected, however, that account is not listed under the
Security tab for the mdb file or the directory that the mdb file is in (I
could not find the account listed for anything). I did notice, however, that
the following directory existed on my computer:

C:\Documents and Settings\NJS\ASPNET

How can I give the account the necessary permissions when it is not listed
under the Security tab? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Hi, Nathan.

Here's a short file you can use to determine
which account ASP.NET is running as :
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------

Run it, and it will tell you the name of the account you need to give
read/write
permissions to, for the directory where your mdb file is located, so it's
allowed
to read and write to the database.

Are you running a secured database ( username/password needed to read it
? )
Or just using the admin with no password ?





Nathan Sokalski said:
Thank you for that information, it was definitely an error that would
have caused me problems. However, I am now recieving the following error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot
open the file
'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is
already opened exclusively by another user, or you need permission to
view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
+36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is
the first thing I did after booting my computer). I tried looking at the
security tab in the properties of nathansokalski_com.mdb, but the only 2
accounts there were mine and SYSTEM (it did not list others like Internet
Guest Account, Launch IIS Process Account, VS Developers, etc.). It is
listed in Visual Studio as part of the Application. What do I need to do
to either the file or my code to be able to use the database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE="
& Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not
know what the problem is. The error returned when I try to view the
page in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my
connection string should look like? Thanks.
 
J

Juan T. Llibre

Right click the folder for which you want to
grant permissions for, using Windows Explorer.

Select "Properties", and then click the "Security" tab.
Click "Add", and then click "Advanced".

Click "Find Now".
Scroll down to the "NJS\ASPNET" account

Assign read, change and write permissions to it.
OK your way out of the dialog.

I am assuming that NJS is the computer
where the nathansokalski_com.mdb is located.

Is that right ?






Nathan Sokalski said:
When I ran the code you gave me, the account it returned was NJS\ASPNET, which is what I
expected, however, that account is not listed under the Security tab for the mdb file or
the directory that the mdb file is in (I could not find the account listed for
anything). I did notice, however, that the following directory existed on my computer:

C:\Documents and Settings\NJS\ASPNET

How can I give the account the necessary permissions when it is not listed under the
Security tab? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Hi, Nathan.

Here's a short file you can use to determine
which account ASP.NET is running as :
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------

Run it, and it will tell you the name of the account you need to give read/write
permissions to, for the directory where your mdb file is located, so it's allowed
to read and write to the database.

Are you running a secured database ( username/password needed to read it ? )
Or just using the admin with no password ?





Nathan Sokalski said:
Thank you for that information, it was definitely an error that would have caused me
problems. However, I am now recieving the following error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file
'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is already opened
exclusively by another user, or you need permission to view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is the first thing
I did after booting my computer). I tried looking at the security tab in the
properties of nathansokalski_com.mdb, but the only 2 accounts there were mine and
SYSTEM (it did not list others like Internet Guest Account, Launch IIS Process
Account, VS Developers, etc.). It is listed in Visual Studio as part of the
Application. What do I need to do to either the file or my code to be able to use the
database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





I am trying to connect to a Microsoft Access Database from my ASP.NET Application. I
use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE=" &
Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not know what the
problem is. The error returned when I try to view the page in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
+304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my connection
string should look like? Thanks.
 
J

Jeff Cochran

When I ran the code you gave me, the account it returned was NJS\ASPNET,
which is what I expected, however, that account is not listed under the
Security tab for the mdb file or the directory that the mdb file is in (I
could not find the account listed for anything). I did notice, however, that
the following directory existed on my computer:

C:\Documents and Settings\NJS\ASPNET

How can I give the account the necessary permissions when it is not listed
under the Security tab? Thanks.

What operating system? Did you add the account?

Jeff
 
N

Nathan Sokalski

That is correct, NJS is the computer where nathansokalski_com.mdb is
located.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Right click the folder for which you want to
grant permissions for, using Windows Explorer.

Select "Properties", and then click the "Security" tab.
Click "Add", and then click "Advanced".

Click "Find Now".
Scroll down to the "NJS\ASPNET" account

Assign read, change and write permissions to it.
OK your way out of the dialog.

I am assuming that NJS is the computer
where the nathansokalski_com.mdb is located.

Is that right ?






Nathan Sokalski said:
When I ran the code you gave me, the account it returned was NJS\ASPNET,
which is what I expected, however, that account is not listed under the
Security tab for the mdb file or the directory that the mdb file is in (I
could not find the account listed for anything). I did notice, however,
that the following directory existed on my computer:

C:\Documents and Settings\NJS\ASPNET

How can I give the account the necessary permissions when it is not
listed under the Security tab? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Hi, Nathan.

Here's a short file you can use to determine
which account ASP.NET is running as :
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------

Run it, and it will tell you the name of the account you need to give
read/write
permissions to, for the directory where your mdb file is located, so
it's allowed
to read and write to the database.

Are you running a secured database ( username/password needed to read it
? )
Or just using the admin with no password ?





Thank you for that information, it was definitely an error that would
have caused me problems. However, I am now recieving the following
error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot
open the file
'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is
already opened exclusively by another user, or you need permission to
view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is
the first thing I did after booting my computer). I tried looking at
the security tab in the properties of nathansokalski_com.mdb, but the
only 2 accounts there were mine and SYSTEM (it did not list others like
Internet Guest Account, Launch IIS Process Account, VS Developers,
etc.). It is listed in Visual Studio as part of the Application. What
do I need to do to either the file or my code to be able to use the
database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE="
& Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not
know what the problem is. The error returned when I try to view the
page in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what
my connection string should look like? Thanks.
 
J

Juan T. Llibre

re:
That is correct, NJS is the computer where nathansokalski_com.mdb is located.

Then the procedure outlined for assigning permissions should work:

Right click the folder for which you want to
grant permissions for, using Windows Explorer.

Select "Properties", and then click the "Security" tab.
Click "Add", and then click "Advanced".

Click "Find Now".
Scroll down to the "NJS\ASPNET" account

Double-click the account to add it to the ACLs for the folder.

Assign read, change and write permissions to it. ( checkboxes )
OK your way out of the dialog.

Let us know if that works. It should.





Nathan Sokalski said:
That is correct, NJS is the computer where nathansokalski_com.mdb is located.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Right click the folder for which you want to
grant permissions for, using Windows Explorer.

Select "Properties", and then click the "Security" tab.
Click "Add", and then click "Advanced".

Click "Find Now".
Scroll down to the "NJS\ASPNET" account

Assign read, change and write permissions to it.
OK your way out of the dialog.

I am assuming that NJS is the computer
where the nathansokalski_com.mdb is located.

Is that right ?






Nathan Sokalski said:
When I ran the code you gave me, the account it returned was NJS\ASPNET, which is what
I expected, however, that account is not listed under the Security tab for the mdb
file or the directory that the mdb file is in (I could not find the account listed for
anything). I did notice, however, that the following directory existed on my computer:

C:\Documents and Settings\NJS\ASPNET

How can I give the account the necessary permissions when it is not listed under the
Security tab? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Hi, Nathan.

Here's a short file you can use to determine
which account ASP.NET is running as :
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------

Run it, and it will tell you the name of the account you need to give read/write
permissions to, for the directory where your mdb file is located, so it's allowed
to read and write to the database.

Are you running a secured database ( username/password needed to read it ? )
Or just using the admin with no password ?





Thank you for that information, it was definitely an error that would have caused me
problems. However, I am now recieving the following error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file
'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is already opened
exclusively by another user, or you need permission to view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
+304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is the first
thing I did after booting my computer). I tried looking at the security tab in the
properties of nathansokalski_com.mdb, but the only 2 accounts there were mine and
SYSTEM (it did not list others like Internet Guest Account, Launch IIS Process
Account, VS Developers, etc.). It is listed in Visual Studio as part of the
Application. What do I need to do to either the file or my code to be able to use
the database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





I am trying to connect to a Microsoft Access Database from my ASP.NET Application.
I use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE=" &
Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not know what
the problem is. The error returned when I try to view the page in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
+304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32
maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender, EventArgs e)
in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my connection
string should look like? Thanks.
 
S

Steve Long

Nathan,
when you select the security tab on the folder properties dialog, click on
the Locations button and select your computer. It should be at the top of
the list. After you do that, type in ASPNET in the textbox below that and
click the check Names button. It should find NJS\ASPNET.
Assuming you are using XP of course.

Steve

Nathan Sokalski said:
When I ran the code you gave me, the account it returned was NJS\ASPNET,
which is what I expected, however, that account is not listed under the
Security tab for the mdb file or the directory that the mdb file is in (I
could not find the account listed for anything). I did notice, however, that
the following directory existed on my computer:

C:\Documents and Settings\NJS\ASPNET

How can I give the account the necessary permissions when it is not listed
under the Security tab? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Juan T. Llibre said:
Hi, Nathan.

Here's a short file you can use to determine
which account ASP.NET is running as :
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------

Run it, and it will tell you the name of the account you need to give
read/write
permissions to, for the directory where your mdb file is located, so it's
allowed
to read and write to the database.

Are you running a secured database ( username/password needed to read it
? )
Or just using the admin with no password ?





Nathan Sokalski said:
Thank you for that information, it was definitely an error that would
have caused me problems. However, I am now recieving the following error:

[OleDbException (0x80004005): The Microsoft Jet database engine cannot
open the file
'c:\inetpub\wwwroot\WebApplication1\nathansokalski_com.mdb'. It is
already opened exclusively by another user, or you need permission to
view its data.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
+36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

I know it is not opened by another user (including me, because this is
the first thing I did after booting my computer). I tried looking at the
security tab in the properties of nathansokalski_com.mdb, but the only 2
accounts there were mine and SYSTEM (it did not list others like Internet
Guest Account, Launch IIS Process Account, VS Developers, etc.). It is
listed in Visual Studio as part of the Application. What do I need to do
to either the file or my code to be able to use the database? Thanks.
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Try :

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=

DATA SOURCE is 2 words, not one.





I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:

cmdSelect.Connection = New
System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOUR
CE="
& Server.MapPath("/WebApplication1/nathansokalski_com.mdb"))


Although the error does not occur until the Fill() method is called:

dataadapterSelect.Fill(ratedpoems, "poemratings")


I have a feeling the problem is in my connection string, but I do not
know what the problem is. The error returned when I try to view the
page in my browser is:

[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
WebApplication1.poetry.poemratings.SortPoems_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:68
WebApplication1.poetry.poemratings.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\WebApplication1\poetry\poemratings.aspx.vb:42
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


Can someone please help me figure out what I am doing wrong or what my
connection string should look like? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top