Author: andy13c72back | Posted on: 10/2/2009 8:27:18 AM | Views : 435

Hi,

I'm using SQLSERVER 2008 in Windows 7 and trying to run this code:


System.Data.OleDb.OleDbConnection odbSearch = new System.Data.OleDb.OleDbConnection("Provider=\"MSIDXS.1\";Integrated Security .='';Data Source=\"CatalogName\";");

System.Data.OleDb.OleDbCommand cmdSearch = new System.Data.OleDb.OleDbCommand();
cmdSearch.Connection = odbSearch;

cmdSearch.CommandText = "select doctitle, filename, URL, rank, characterization, Write from scope() where FREETEXT(Contents, '" + searchText + "') and #filename *.htm order by rank desc";

odbSearch.Open();
OleDbDataReader rdrSearch = cmdSearch.ExecuteReader();

I'm getting the following error:

Incorrect syntax near '#filename'. Expected '(', NOT, CAST, CONTAINS, CREATE, FREETEXT, MATCHES, ID. SQLSTATE=42000

Please let me know what could be t ...

Go to the complete details ...