2

I am using Microsoft Search Server 2008 (based on SharePoint Server 2007) + C# + .Net 3.5 + VSTS 2008 + ASP.Net to develop a web application which invokes Search Server 2008 Web Services when a button in the html page is pressed.

I am using the following code to query content from Microsoft Search Server 2008. My question is how to display the search results from the DataSet retrieved? I did not find a very good sample from Google.

    protected void Button1_Click(object sender, EventArgs e)
    {
        //The string containing the keyword to use in the search
        string keywordString = "Microsoft";

        //The XML string containing the query request information 
        //for the Web service
        string qXMLString = "<QueryPacket xmlns='urn:Microsoft.Search.Query'>" +
        "<Query><SupportedFormats><Format revision='1'>" +
        "urn:Microsoft.Search.Response.Document:Document</Format>" +
        "</SupportedFormats><Context><QueryText language='en-US' type='STRING'>" +
        keywordString + "</QueryText></Context></Query></QueryPacket>";

        SearchTest.QueryService queryService = new SearchTest.QueryService();
        queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
        DataSet ds = queryService.QueryEx(qXMLString);
    }

thanks in advance!

1 Answer 1

1

Why don't you just add a DataGridView to your app and then bind to the DataSet like this:

dataGridView.AutoResizeColumns( DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
dataGridView.DataSource = ds.Tables[0];
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.