2

I am using below statement to query the windows search and getting the above error and following error IErrorInfo.GetDescription failed with E_FAIL(0x80004005) .

  var query = "SELECT System.ItemName FROM servername.SystemIndex " +
               "WHERE SCOPE='file://servername/temp/DanB/Newsletter' 
                  and contains('" +   txtSearch.Text + "')";

(I haven't mention the servername above, but I am using the correct server name)

I did search about this error and seems it may occur due to usage of reserved words and symbols. I have gone through Access 2007 reserved words and symbols, and seems the this statement is fine.

Even though, I suspect temp may causing any trouble so I tried [temp] but its same result.

Also I check the value coming from the text box as well.

So I tried coping the file to local drive and it worked.

 var query =  "SELECT System.ItemName FROM SystemIndex " +
              "WHERE SCOPE='file:C:/Users/temp/DanB/Newsletter' 
                 and contains('" + txtSearch.Text + "')";

I have gone thought the FROM Clause regarding the windows search and the syntax (querying network drive) looks fine to me.

Any idea what is causing this issue?

huMpty duMpty
  • 14,346
  • 14
  • 60
  • 99
  • 2
    Assuming Access has it, you should really be using a [parameterized query](http://www.codinghorror.com/blog/2005/04/give-me-parameterized-sql-or-give-me-death.html)... especially if this is taking user input. – Jeff B Sep 20 '13 at 13:58
  • @JeffBridgman:I am testing it with diffrerent keywords, that why I am using a textbox for the moment. But the real issue is the abouve error!! – huMpty duMpty Sep 20 '13 at 14:00
  • Click the windows key and the R key (or bring up the run dialog box) enter in \\servername\temp\DanB\Newsletter does it open a folder? The error is either a permission error or the folder does not exist. the usual context is \\servername\sharename – Sorceri Sep 23 '13 at 16:50
  • @Sorceri: I tried using `run` and it works fine (it brings up the location with no issues) – huMpty duMpty Sep 24 '13 at 12:36
  • @huMptyduMpty Can you check permissions? When you go to the file location yourself, the server is checking your permissions. When you run the code the code will be executed under a different, asp.net login that may not have permissions on the server. Check what login is being used, and that logins permissiosn on the server. – Vulcronos Sep 27 '13 at 16:14
  • @Vulcronos: Windows authentication been used, server permissions are fine as well! – huMpty duMpty Sep 27 '13 at 16:30
  • @huMptyduMpty Can you conect to any file or filepath on the server using c#? We should check if the issue is with the server or just this folder. – Vulcronos Sep 27 '13 at 17:33
  • What kind of OS the remote machine? Are you sure that Windows Search is installed on the remote box? – Lynn Crumbling Sep 30 '13 at 16:10
  • @LynnCrumbling: Yes windows search is there with indexing enabled – huMpty duMpty Sep 30 '13 at 16:14
  • @Vulcronos: Yes, I tried opening same file using the application. It works fine – huMpty duMpty Oct 01 '13 at 14:42
  • @huMptyduMpty I have double checked your syntax and everything else I can find but everything looks good. Unless you can give us more details I don't know anything else to do to help. I would just test different scenarios on your end. Can you search other computers? Other folders on that server? – Vulcronos Oct 02 '13 at 15:20

1 Answers1

0

We have remove the indexing from the server and re-set it up. Which workd fine now

huMpty duMpty
  • 14,346
  • 14
  • 60
  • 99