J
Jorge Varona
Greetings,
I am having a difficult time trying to get my index server query to work.
Here's the code:
// create a connection object and command object, to connect the Index
Server
System.Data.OleDb.OleDbConnection odbSearch = new
System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand cmdSearch = new
System.Data.OleDb.OleDbCommand();
//assign the connecting string to the oledb connection object
odbSearch.ConnectionString = string.Format("Provider=MSIDXS;Data
Source={0};","intranet");
//assign connection to command object cmdSearch
cmdSearch.Connection = odbSearch;
//Query to search a free text string in the catalog in the contents of the
indexed documents in the catalog
try
{
cmdSearch.CommandText = "select doctitle, filename, vpath, rank,
characterization "
+" from scope('DEEP TRAVERSAL OF \"/\")' "
+" where FREETEXT('"+txtSearch.Text +"') "
+" and filename <> 'search.aspx' order by rank desc ";
odbSearch.Open();
int cnt;
try
{
OleDbDataReader rdrSearch = cmdSearch.ExecuteReader();
//dg1.DataSource=rdrSearch;
//dg1.DataBind();
//cnt=1;
while( rdrSearch.Read())
{
//Response.Write("OK<br>");
System.Diagnostics.Debug.WriteLine(rdrSearch[0].ToString());
getpagelink(rdrSearch);
}
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
odbSearch.Close();
}
Does anyone have any ideas why this wont work?
I am having a difficult time trying to get my index server query to work.
Here's the code:
// create a connection object and command object, to connect the Index
Server
System.Data.OleDb.OleDbConnection odbSearch = new
System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand cmdSearch = new
System.Data.OleDb.OleDbCommand();
//assign the connecting string to the oledb connection object
odbSearch.ConnectionString = string.Format("Provider=MSIDXS;Data
Source={0};","intranet");
//assign connection to command object cmdSearch
cmdSearch.Connection = odbSearch;
//Query to search a free text string in the catalog in the contents of the
indexed documents in the catalog
try
{
cmdSearch.CommandText = "select doctitle, filename, vpath, rank,
characterization "
+" from scope('DEEP TRAVERSAL OF \"/\")' "
+" where FREETEXT('"+txtSearch.Text +"') "
+" and filename <> 'search.aspx' order by rank desc ";
odbSearch.Open();
int cnt;
try
{
OleDbDataReader rdrSearch = cmdSearch.ExecuteReader();
//dg1.DataSource=rdrSearch;
//dg1.DataBind();
//cnt=1;
while( rdrSearch.Read())
{
//Response.Write("OK<br>");
System.Diagnostics.Debug.WriteLine(rdrSearch[0].ToString());
getpagelink(rdrSearch);
}
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
odbSearch.Close();
}
Does anyone have any ideas why this wont work?