80004005 - unspecified error - jet db engine
- From: "Morgan Wade" <mwade@xxxxxxxxx>
- Date: Wed, 20 Dec 2006 13:54:27 -0500
Hello,
I'm running into a 80004005 "unspecified error" when try to open a ".csv"
file using the "Microsoft.Jet.OLEDB.4.0" database driver when executed from
a C# .dll called from an asp.net file.
The same code is running without incident on other instances (Win2K SP4, IIS
5.0 with a 4.0.9 version of the Jet .dll) but is causing the "unspecified
error" on the one instance (XP SP2, IIS 5.1 with a 4.0.8618 version of the
Jet .dll ).
Also, I've placed the code from the C# .dll that opens the connection to the
..csv, selects from it, changes the datatype of a column, fills a dataset
with the data, and then closes the connection, in a C# Windows Application
and run it on the problem instance with no error. The code is precisely the
same.
Since the C# Windows App works fine I thought maybe there was something
about asp.net or IIS that is causing the complication, something to do with
the configuration or permissions. I've tried to mirror the problem instance
on the working instance in every way, including giving full permissions to
the logged in User's Temp directory and the Windows/Temp directory to
Everyone/IUSR/Network Service/ASP.Net. I've given the same permissions to
the Jet .dll. I've opened up the permissions on the directory where the
..csv resides. I've made sure that all the relevant directories have Read
Only unchecked.
All to no avail.
Does anyone have any suggestions on what to look for, on what else I can
try?
Here is the code I am running successfully in a C# Windows app and in a C#
..dll called from asp.net on other IIS servers, but that is erroring out on
one IIS server.
private void button1_Click(object sender, EventArgs e)
{
try
{
string strDataSetName;
string strFileLocation;
string strFileName;
strFileName = "importfile.csv";
strFileLocation = "c:\\webapp\\www\\MM\\UploadedFiles";
//declare connection,datadapter and dataset
//create conn variable here so it can be closed in the
Finally clause
OleDbConnection conn;
OleDbDataAdapter daContacts;
DataSet dsContacts;
strDataSetName = "importfile";
//create connection - Use the OLE DB Text driver to retrieve
the external data
//"HDR=Yes;" indicates that the first row contains
columnnames, not data
conn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
strFileLocation + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited\"");
daContacts = new OleDbDataAdapter();
dsContacts = new DataSet();
//set selectcommand property
conn.Open();
//fill the dataset with an empty resultset first, to
establish the DataTable name and structure
daContacts.SelectCommand = new OleDbCommand("select * from "
+ strFileName + " where 1=2", conn);
//populate the dataset
daContacts.Fill(dsContacts, strDataSetName);
//make sure that the first column, EKey, is set as a String
column, for later querying
dsContacts.Tables[0].Columns[0].DataType =
System.Type.GetType("System.String");
//now populate the dataset with full data
daContacts.SelectCommand = new OleDbCommand("select * from "
+ strFileName, conn);
//populate the dataset
daContacts.Fill(dsContacts, strDataSetName);
conn.Close();
//return dsContacts;
}
catch (SqlException SqlEx) //On Sql Exception
{
LogError("TestImport", SqlEx.Message,
SqlEx.Number.ToString(), SqlEx.LineNumber.ToString(), SqlEx.Source);
throw SqlEx;
}
catch (Exception Ex) //On Any other Exception
{
LogError("TestImport", Ex.Message, "", "", Ex.Source);
throw Ex;
}
finally
{
LogError("TestImport", "Done", "", "", "");
}
}
Thanks in advance for any advice,
Morgan
.
- Prev by Date: Re: SQL for Pivot Result
- Next by Date: Re: SQL for Pivot Result
- Previous by thread: Re: SQL for Pivot Result
- Next by thread: Re: Ole db provider for an odbc data source
- Index(es):