c# - Windows indexing search - OleDbException Not Specified Error -
i'm getting exception (oledbexception: not specified error) when trying search in indexed files in folder on d-drive (d:\taaltipsdocumenten). know piece of code worked in past (2 months ago), when trying continue working on project, doesn't seem work anymore.
during execution of following code, error on following line:
adapter.fill(dt);
i can datatable (dt) filled correctly, still error on line. when trying use oledbdatareader .next() function, runs on results , throws me error eventually.
var query11 = @"select system.datecreated, system.itemname, system.itemurl, system.size, system.search.hitcount systemindex " + @"where scope ='file:d:/taaltipsdocumenten' , 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 (not specified):
system.data.oledb.oledbexception unhandled user code errorcode=-2147467259 hresult=-2147467259 message=not specified error source=system.data stacktrace: @ system.data.oledb.oledbdatareader.processresults(oledbhresult hr) @ system.data.oledb.oledbdatareader.getrowhandles() @ system.data.oledb.oledbdatareader.readrowset() @ system.data.oledb.oledbdatareader.read() @ system.data.common.dataadapter.fillloaddatarow(schemamapping mapping) @ system.data.common.dataadapter.fillfromreader(dataset dataset, datatable datatable, string srctable, datareadercontainer datareader, int32 startrecord, int32 maxrecords, datacolumn parentchaptercolumn, object parentchaptervalue) @ system.data.common.dataadapter.fill(datatable[] datatables, idatareader datareader, int32 startrecord, int32 maxrecords) @ system.data.common.dbdataadapter.fillinternal(dataset dataset, datatable[] datatables, int32 startrecord, int32 maxrecords, string srctable, idbcommand command, commandbehavior behavior) @ system.data.common.dbdataadapter.fill(datatable[] datatables, int32 startrecord, int32 maxrecords, idbcommand command, commandbehavior behavior) @ system.data.common.dbdataadapter.fill(datatable datatable) @ taaltips.controllers.homecontroller.search(string word) in d:\projects\taaltips\taaltips\controllers\homecontroller.cs:line 40 @ lambda_method(closure , controllerbase , object[] ) @ system.web.mvc.actionmethoddispatcher.execute(controllerbase controller, object[] parameters) @ system.web.mvc.reflectedactiondescriptor.execute(controllercontext controllercontext, idictionary
2 parameters) @ system.web.mvc.controlleractioninvoker.invokeactionmethod(controllercontext controllercontext, actiondescriptor actiondescriptor, idictionary
2 parameters) @ system.web.mvc.async.asynccontrolleractioninvoker.b__39(iasyncresult asyncresult, actioninvocation innerinvokestate) @ system.web.mvc.async.asyncresultwrapper.wrappedasyncresult2.callenddelegate(iasyncresult asyncresult) @ system.web.mvc.async.asyncresultwrapper.wrappedasyncresultbase
1.end() @ system.web.mvc.async.asynccontrolleractioninvoker.endinvokeactionmethod(iasyncresult asyncresult) @ system.web.mvc.async.asynccontrolleractioninvoker.asyncinvocationwithfilters.b__3d() @ system.web.mvc.async.asynccontrolleractioninvoker.asyncinvocationwithfilters.<>c__displayclass46.b__3f() innerexception:
i tried things already:
- restart windows search service
- remove index folder , add again
- restart computer
- make sure connections closed
- create different folder , try on 1 (same error)
- use oledbdatareader , reader.next(), gives same error
someone has idea?
thanks in advance !
this not answer instead suggestion.
i try eliminating dataadapter, see if same exception via datatable.load per test1 or perhaps in test2 trying cycle through results.
neither meant solution rather way see if exception caused perhaps reading specific data, perhaps excessive rows etc.
note, in test2 did 1 column. try or columns allow loop run , see if specific row throws exception there see if specific column value issue.
using system; using system.data; using system.data.oledb; namespace demo { class class1 { void test1() { var word = "place hard code value here"; var query11 = @"select system.datecreated, system.itemname, system.itemurl, system.size, system.search.hitcount systemindex " + @"where scope ='file:d:/taaltipsdocumenten' , contains('" + word + "') "; datatable dt = new datatable(); using (oledbconnection connection = new oledbconnection(@"provider=search.collatordso;extended properties=""application=windows""")) { using (oledbcommand command = new oledbcommand(query11, connection)) { connection.open(); try { dt.load(command.executereader()); console.writeline(dt.rows.count); } catch (exception) { // place break-pointhere } } } } void test2() { var word = "place hard code value here"; var query11 = @"select system.datecreated, system.itemname, system.itemurl, system.size, system.search.hitcount systemindex " + @"where scope ='file:d:/taaltipsdocumenten' , contains('" + word + "') "; using (oledbconnection connection = new oledbconnection(@"provider=search.collatordso;extended properties=""application=windows""")) { using (oledbcommand command = new oledbcommand(query11, connection)) { connection.open(); try { var reader = command.executereader(); if (reader.hasrows) { while (reader.read()) { console.writeline($"date: {reader.getdatetime(0)}"); } } } catch (exception) { // place break-pointhere } } } } } }
Comments
Post a Comment