I developed a webapplication using winxp and visual studio 2004. I deployed it on a server running win2k server. they both are using v.1.4322.573 When I try to use a part of the app that reads and excel file into a datagrid, and exception is thrown with the
following info.
Server Error in '/MR' Application.
--------------------------------------------------------------------------------
Unspecified error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Unspecified error
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OleDbException (0x80004005): Unspecified error]
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) +38
VendorDatabase.excelHandler.excelToDatagrid(String filepath, String importType) in c:\inetpub\wwwroot\VendorDatabase\excelHandler.vb:31
VendorDatabase.WebForm1.btnImportFileImport_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\VendorDatabase\WebForm1.aspx.vb:781
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
this is the code where it fails
Function excelToDatagrid(ByVal filepath As String, ByVal importType As String) As DataSet
Dim strConn As String
Dim myCommand As OleDb.OleDbDataAdapter
Dim conn As OleDb.OleDbConnection
Dim mydataset As DataSet
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + filepath + ";" + "Extended Properties=Excel 8.0;Persist Security Info=False;"
conn = New OleDb.OleDbConnection(strConn)
myCommand = New OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn)
mydataset = New DataSet
myCommand.Fill(mydataset)
myCommand.Dispose()
Return mydataset
End Function
Is there a reason for the "@" symbol in your connection string? However, the code seems to work in principle. Does the ASP application have read permissions over the folder that the file is in? If you step through the code in debug mode, can you see where the
error is thrown? I'm puzzled as to why it does not seem to be making use of the code in the catch statements, especially as you are catching generic exceptions. What code is at line 25?
solved. this has to do with impersonation. in web.config, i set impersonate back to false and it works. i read in another article on this forum that because when .net reads an excel file, it creats a temp folder to store the data, and that temp folder can only
be access by the ASPNET account. so if you impersonate as another user on the computer / network and tried to use ASPNET to read the data in the excel file, you will not be able to.
i think the point here is that the asp.net user are not able to create files
in the temporary folder!
you can go to the temp folder ( ex. Document settings\servername\aspnet\)
and there on the temp folder give the full right access for the asp.net
user. i hope this may solve the problem
The scripts that access databases were working fine until I had to delete the wwwroot folder and recreate it, copying the files back in again. When I copied the files back in the SQL database didn't work. After a lot of hunting about I fixed that, but now
whenver a script tries to access an Access database I get the
Unspecified error
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
message appearing. I can't get rid of it, I've made sure aspnet can read/write/modify the database files and the containing directory. I've also done the above and gone to Documents and Settings\FRED\aspnet\ - there is no Temp folder so I created one
and gave aspnet the permissions nescessary. I also gave it permissions on the Temp folder in Documents and Settings\FRED\aspnet\Local Setttings, but this didn't help either.
Never mind - I eventually came across this: http://support.microsoft.com/kb/827190
Changing (actually inserting) the <identity impersonate="false" /> has fixed it.
It must have happened when I merged the two web.config files from the part I'm writing with the part my colleague did. Of all the useful error messages in the world....!
In my Documents and Settings folder, i can't see any servername folder, only user folder, where i can find ASPNET folder in my win 2003 system [Angel] ?
kurdtsson
Member
20 Points
4 Posts
System.Data.OleDb.OleDbException: Unspecified error
Aug 20, 2003 10:50 PM|LINK
Function excelToDatagrid(ByVal filepath As String, ByVal importType As String) As DataSet Dim strConn As String Dim myCommand As OleDb.OleDbDataAdapter Dim conn As OleDb.OleDbConnection Dim mydataset As DataSet strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + filepath + ";" + "Extended Properties=Excel 8.0;Persist Security Info=False;" conn = New OleDb.OleDbConnection(strConn) myCommand = New OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn) mydataset = New DataSet myCommand.Fill(mydataset) myCommand.Dispose() Return mydataset End Functionhltommy
Member
100 Points
20 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Nov 30, 2004 10:51 PM|LINK
"); } catch(OleDbException e) { String err_msg = ""; for (int i = 0; i < e.Errors.Count; i++) err_msg += "----------------
Index #" + i + "
Message: " + e.Errors[i].Message + "
NativeError: " + e.Errors[i].NativeError + "
Source: " + e.Errors[i].Source + "
SQLState: " + e.Errors[i].SQLState + "
"; Response.Write(err_msg + "
"); Response.Write(e.ToString() + "
"); } catch(Exception e) { Response.Write(e.ToString() + "
"); } finally { MyConnection.Close(); } }
rohan_p
Member
190 Points
38 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Dec 01, 2004 03:40 AM|LINK
rohan_p
Member
190 Points
38 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Dec 01, 2004 09:08 PM|LINK
hltommy
Member
100 Points
20 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Dec 14, 2004 08:07 PM|LINK
gdurmus
Member
5 Points
1 Post
Re: System.Data.OleDb.OleDbException: Unspecified error
Nov 01, 2005 09:02 AM|LINK
i think the point here is that the asp.net user are not able to create files
in the temporary folder!
you can go to the temp folder ( ex. Document settings\servername\aspnet\)
and there on the temp folder give the full right access for the asp.net
user. i hope this may solve the problem
Gursoy DURMUS
Turkiye
nerd.
Member
8 Points
4 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
May 03, 2007 11:04 PM|LINK
The scripts that access databases were working fine until I had to delete the wwwroot folder and recreate it, copying the files back in again. When I copied the files back in the SQL database didn't work. After a lot of hunting about I fixed that, but now whenver a script tries to access an Access database I get the
Unspecified error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Data.OleDb.OleDbException: Unspecified error
message appearing. I can't get rid of it, I've made sure aspnet can read/write/modify the database files and the containing directory. I've also done the above and gone to Documents and Settings\FRED\aspnet\ - there is no Temp folder so I created one and gave aspnet the permissions nescessary. I also gave it permissions on the Temp folder in Documents and Settings\FRED\aspnet\Local Setttings, but this didn't help either.
I'm at a complete loss! Help!!
access OleDbException unspecified error
nerd.
Member
8 Points
4 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
May 03, 2007 11:10 PM|LINK
Never mind - I eventually came across this: http://support.microsoft.com/kb/827190
It must have happened when I merged the two web.config files from the part I'm writing with the part my colleague did. Of all the useful error messages in the world....!Changing (actually inserting) the <identity impersonate="false" /> has fixed it.
linhlinhmail
Member
2 Points
6 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Jul 20, 2007 12:18 AM|LINK
"Document settings\servername\aspnet"
In my Documents and Settings folder, i can't see any servername folder, only user folder, where i can find ASPNET folder in my win 2003 system [Angel] ?
Thanks !
krishnaprasa...
Participant
858 Points
171 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Oct 29, 2007 07:11 AM|LINK
May be your folder is hidden
goto tools->folder options ->view->hidden files and folders->enable show
MCTS