SEHException on opening connection to Access database

  • Thread starter Thread starter David Hauser
  • Start date Start date
D

David Hauser

Hi

I moved an ASP.NET website to a new server an suddenly got the following
error when connection to my MS Access database:
"System.Runtime.InteropServices.SEHException: External component has thrown
an exception".

Searching the web and newsgroups for a solution I found several pages with
this topic, but it seems like it's a very general Exception... hints for my
specific problem i did not find.

Here's the code which throws the exception (at line 3, cn.Open()):

using (OleDbConnection cn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
source=C:\Data\MyDataBase.mdb"))
{
cn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM Content ORDER BY
Title");
cmd.Connection = cn;
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
// do something
}
cn.Close();
}

Thanks a lot for your help.

Greets, Dave
 
I would guess a security issue, most probably NTFS one.
Make sure that account which runs server application has enough file
privileges to mdb file.
 
Thanks for your advice. I tried that before but the error occurs even with
full access for everyone .
Any other idea?


Miha Markic said:
I would guess a security issue, most probably NTFS one.
Make sure that account which runs server application has enough file
privileges to mdb file.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

David Hauser said:
Hi

I moved an ASP.NET website to a new server an suddenly got the following
error when connection to my MS Access database:
"System.Runtime.InteropServices.SEHException: External component has
thrown an exception".

Searching the web and newsgroups for a solution I found several pages
with this topic, but it seems like it's a very general Exception... hints
for my specific problem i did not find.

Here's the code which throws the exception (at line 3, cn.Open()):

using (OleDbConnection cn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
source=C:\Data\MyDataBase.mdb"))
{
cn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM Content ORDER BY
Title");
cmd.Connection = cn;
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
// do something
}
cn.Close();
}

Thanks a lot for your help.

Greets, Dave
 
Back
Top