Index Service Call Code (C #)

xiaoxiao2021-03-06  111

Private void Button1_Click (Object Sender, System.Eventargs E)

{

// Catalog Name

String stratalog = "testcatalog";

String strquery = "";

StrQuery = "Select Doct Dock, filename, size, path, url from scope () Where freetext ('" textbox1.text ")"

// textbox1.text is the word this you type in the text box to query by using indexing service.

String connString = "provider = msidxs.1; integrated security. = '; data source =" strcatalog;

System.data.oledb.oledbconnection conn = new system.data.oledb.oledbconnection (connString);

Cn.open ();

System.Data.oledb.oledbdataadapter cmd = new system.data.oledb.oledbdataadapter (strquery, conn);

System.Data.DataSet TestDataSet = new system.data.dataset ();

Cmd.Fill (TestDataSet, "SearchResults");

DataView Source = New DataView (TestDataSet.Tables [0]);

DataGrid1.datasource = Source;

DataGrid1.databind ();

}

转载请注明原文地址:https://www.9cbs.com/read-98215.html

New Post(0)