searching index server with C# problem

Apr 6 2006 8:49 AM
I found some code on how to run a search against index server, but it
isn't working.  I'm getting an exception saying...

System.Data.OleDb.OleDbException: Column 'AGENCYID' has not been
defined. SQLSTATE=42S22

Here's my code.

            System.Data.OleDb.OleDbConnection odbSearch = new
System.Data.OleDb.OleDbConnection();
            System.Data.OleDb.OleDbCommand cmdSearch = new
System.Data.OleDb.OleDbCommand();
            odbSearch.ConnectionString = "Provider=\"MSIDXS\";Data
Source=\"JobAdCatalog\";";

            cmdSearch.Connection = odbSearch;
            cmdSearch.CommandText = "Select AgencyId from scope() where
@Site=230 order by rank desc";

            odbSearch.Open();
            try
            {
                OleDbDataReader rd = cmdSearch.ExecuteReader();
                Console.WriteLine(rd[0].ToString());
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.ToString());
            }
            odbSearch.Close(); odbSearch.Dispose(); odbSearch = null;
            Console.ReadLine();

Since AgencyId is not in the text part of the htm but in the meta
portion, I'm not sure if I have the query correct.  But, in relation to
the error, I've used the IXSSO.Query object in VB6 and had to define
columns.  It appears that's the problem here, but I'm not sure how to
define columns in this case.  Can anyone shed some light on this?
Thanks.