I'm getting an exception (OleDBException: Not specified Error) when trying to search in indexed files in a folder on my D-drive (D:\TaalTipsDocumenten). I know this piece of code worked in the past (2 months ago), but when trying to continue working on that project, it doesn't seem to work anymore.
During execution of the following code, I get an error on the following line:
adapter.Fill(dt);
I can say that the Datatable (dt) is filled correctly, but I still get an error on that line. Also when trying to use a OleDbDataReader with .Next() function, it runs over the results and throws me the error eventually.
var query11 = @"SELECT System.DateCreated,
System.ItemName,
System.ItemUrl,
System.Size,
System.Search.HitCount FROM SystemIndex " +
@"WHERE scope ='file:D:/TaalTipsDocumenten' AND CONTAINS('" + word + "') ";
FileOverviewModel returnModel = new FileOverviewModel();
returnModel.Files = new List<FileModel>();
returnModel.Search = word;
DataTable dt = new DataTable();
using (OleDbConnection connection = new OleDbConnection(@"Provider=Search.CollatorDSO;Extended Properties=""Application=Windows"""))
using (OleDbCommand command = new OleDbCommand(query11, connection))
using (OleDbDataAdapter adapter = new OleDbDataAdapter(command))
{
adapter.Fill(dt);
}
The error doesn't say much (Not specified):
System.Data.OleDb.OleDbException was unhandled by user code ErrorCode=-2147467259 HResult=-2147467259 Message=Not specified error Source=System.Data StackTrace: at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr) at System.Data.OleDb.OleDbDataReader.GetRowHandles() at System.Data.OleDb.OleDbDataReader.ReadRowset() at System.Data.OleDb.OleDbDataReader.Read() at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at TaalTips.Controllers.HomeController.Search(String word) in D:\Projects\TaalTips\TaalTips\Controllers\HomeController.cs:line 40 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase
1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.b__3f() InnerException:
I tried some things already:
- Restart Windows Search Service
- Remove index from the folder and add it again
- Restart computer
- Make sure all connections are closed
- Create a different folder and try on that one (same error)
- Use OleDbDataReader and reader.Next(), but gives same error
Someone has any idea?
Thanks in advance !