Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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];
share|improve this answer
    
Cool, thanks Wictor! –  George2 Mar 10 '10 at 7:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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