Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to use a URL to pass parameter information with an SQL query for a data source by using FrontPage 2003 and Windows SharePoint Services


View products that this article applies to.

Introduction

This article describes how to use a URL to pass parameter information with a Microsoft SQL query for a data source by using Microsoft Office FrontPage 2003 and Microsoft Windows SharePoint Services.

↑ Back to the top


More information

To use a URL to pass parameter information with an SQL query for a data source, follow these steps:
  1. Start FrontPage 2003, and then open your Microsoft Windows SharePoint Services Web site.
  2. On the File menu, click New.
  3. Click the Task Pane list that is located in the right pane, and then click Data Source Catalog.
  4. In the Task Pane list, expand Database Connections, and then click Add to Catalog.
  5. Click the General tab, and then type the name that you want to use, such as Northwind Products.
  6. Click the Source tab, and then click Configure Database Connection.
  7. Type the server name of your SQL server.

    Note This example uses the Northwind sample database.
  8. Select the authentication method that you want, and then click Next.

    The Configure Database Connection dialog box appears.
  9. In the Database list, click Northwind.
  10. Click to select the Use custom query check box, click Edit, and then type the following SQL query:
    USE Northwind SELECT * FROM Products
  11. Click OK, click Finish, and then click OK.
  12. In the Task Pane list, click Insert Data View in the Custom Query list.
  13. Change the view to Code view. To do this, click the Code tab in the lower part of your FrontPage 2003 window.
  14. Locate the element that is named dsp:commandText. Add a WHERE clause to the SQL query, after the word Products. To do this, type the following:
    WHERE ProductID &gt; <udc:ClientParameterValue Name="MyQueryField"/>
    The SQL query should look similar to the following:
    USE Northwind SELECT * FROM Products WHERE ProductID &gt; <udc:ClientParameterValue Name="MyQueryField"/>
    Note You must type &gt;. This encodes the HTML greater than (>) symbol.
  15. Locate the ClientParamaterBindings element. Add a child element to the list of ClientParamaterBindings elements. To do this, type the following text as the last element in the list:
    <udc:ClientParameterBinding Name="MyQueryField" Location="Postback;QueryString(MyPostField)" DefaultValue="0"/>
    Note The Name value must be the same as the Name value that you used for the SQL WHERE clause in step 14. In this example, the Name value is MyQueryField.
  16. Locate the ParameterBindings element. Add a child element to the list of ParameterBindings elements. To do this, type the following as the last element in the list:
    <ParameterBinding Name="MyQueryField" Location="Postback;QueryString(MyPostField)" DefaultValue="0"/>
    Note The Name value must be the same as the Name value in the SQL clause. In this example, the Name value is MyQueryField.
  17. Save the page as an .aspx file--for example, page2.aspx.
  18. Start a Web browser program, such as Microsoft Internet Explorer, and then open the page by adding the following text:
    ?MyPostField=5
    In this example, the Web page file name is page2.aspx. The file name and the parameter will look similar to the following, where MySite is the name of your Windows SharePoint Services Web site:
    http://MySite/Page2.aspx?MyPostField=5
    Note Your data view will show only those products from the Northwind database that have a ProductID that is larger than five.
  19. In the FrontPage 2003 window, create a new page. To do this, click File, click New, and then click Blank page in the right pane.
  20. Change the view to Code view. To do this, click the Code tab in the lower part of your FrontPage 2003 window.
  21. Create a form for the page. To do this, type, or copy and paste the following HTML code in the body section of the page:
    <form action="page2.aspx" method="get">
    <select name="MyPostField" size="1">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    </select>
    <input type="submit">
    </form>
  22. Save the page as an .aspx file--for example, page1.aspx.
  23. Start a Web browser program, such as Internet Explorer, and then open the page. In this example, the Web page file name is page1.aspx.
When you submit the form it will pass the parameter information to the query page.

↑ Back to the top


Keywords: KB873014, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 873014
Revision : 6
Created on : 10/23/2006
Published on : 10/23/2006
Exists online : False
Views : 282