If you are using SQL,You should use SqlConnection,SqlCommand in the System.Data.SqlClient;otherwises if access,you can use OleDb。But as far as I see,I don't think there's a FreeText search in the Access db。
PS:Try to have a test in the sql management studio to test your sql statement to see what's happening——make sure that there's no errors……
vinodreddy
Member
20 Points
7 Posts
indexing service getting error Invalid catalog name 'MyCatlog'. SQLSTATE=42000
Jan 17, 2012 08:47 AM|LINK
hi im trying to access indexing service remotly but im getting ths error Invalid catalog name 'MyCatlog'. SQLSTATE=42000.
this is my code.
string connectionString = string.Format("Provider=MSIDXS.1" );
DataSet dataSet = null;
OleDbConnection connection = null;
string Server="MyMachine";
string Catalog = "MyCatlog";
try
{
connection = new OleDbConnection(connectionString);
connection.Open();
string query = @"SELECT doctitle, vpath, filename, size, write, characterization, rank FROM "+Server+"."+Catalog+"..SCOPE() " +
"WHERE FREETEXT(Contents, '\"" + searchString + "\"') AND (filename Like '%.asp%'" +
" OR filename Like '%.shtml%'" +
")";
OleDbCommand command = new OleDbCommand(query, connection);
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
dataSet = new DataSet();
adapter.Fill(dataSet);
}
catch (Exception ex)
{
throw ex;
}
finally
{
connection.Close();
}
Vinod Reddy
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: indexing service getting error Invalid catalog name 'MyCatlog'. SQLSTATE=42000
Jan 19, 2012 12:12 AM|LINK
Hello:)
If you are using SQL,You should use SqlConnection,SqlCommand in the System.Data.SqlClient;otherwises if access,you can use OleDb。But as far as I see,I don't think there's a FreeText search in the Access db。
PS:Try to have a test in the sql management studio to test your sql statement to see what's happening——make sure that there's no errors……
Reguards!