Friday, November 04, 2005

Site Search Using Windows Catalog Service




string strCatalog = "Test";

string strQuery = "Select Filename,VPath,Path from SCOPE()
where FREETEXT('" + TextBox1.Text + "') ";

string connString = "Provider=MSIDXS;Data Source='" + strCatalog + "'";

OleDbConnection Connection = new OleDbConnection(connString);
Connection.Open();
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, Connection);

DataSet ds = new DataSet();
da.Fill(ds);
Connection.Close();

DataView source= new DataView(ds.Tables[0]);
DataGrid1.DataSource = source;
DataGrid1.DataBind();

No comments: