Home All Groups Group Topic Archive Search About

Query on xls file with OleDbConnection fails after impersonation

Author
31 May 2006 9:59 AM
GB
When i query an xls file using an OleDbConnection after impersonation,
it fails.
Nevertheless it work when i do not impersonate! Conceptually the code
looks like:

-> Start impersonation
->
Dim ExcelConnection As OleDbConnection = New
OleDbConnection(strConnection)
Dim ExcelCommand As OleDbCommand = New OleDbCommand(strPath,
ExcelConnection)
Dim ExcelAdapter As OleDbDataAdapter = New
OleDbDataAdapter(ExcelCommand)
ExcelConnection.Open()
ExcelAdapter.Fill(resultSet)
ExcelConnection.Close()
-> Stop impersonation

The error i get is at the ExcelConnection.Open() command:
    ex    {System.Data.OleDb.OleDbException}
    ErrorCode    -2147467259    Integer
    Message    "Unspecified error"
    Source    "Microsoft JET Database Engine"

I'm sure the impersonated user has full access rights to the map where
the xls file is located + my application is a vb.net application and
not a webapplication (i know the problem has already been discussed a
lot for webapplications...but not for a common desktop application...)
Could anyone tell me what's the reason for this problem and how i can
solve it...
Thanks!

AddThis Social Bookmark Button