Microsoft KB Archive/873014

= 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 =

Article ID: 873014

Article Last Modified on 10/23/2006

-

APPLIES TO


 * Microsoft Office FrontPage 2003
 * Microsoft Windows SharePoint Services

-





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.



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

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

The Configure Database Connection dialog box appears.</li> In the Database list, click Northwind.</li> Click to select the Use custom query check box, click Edit, and then type the following SQL query:

USE Northwind SELECT * FROM Products

</li> Click OK, click Finish, and then click OK.</li> In the Task Pane list, click Insert Data View in the Custom Query list.</li> Change the view to Code view. To do this, click the Code tab in the lower part of your FrontPage 2003 window.</li> 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=&quot;MyQueryField&quot;/>

The SQL query should look similar to the following:

USE Northwind SELECT * FROM Products WHERE ProductID &gt; <udc:ClientParameterValue Name=&quot;MyQueryField&quot;/>

Note You must type &gt;. This encodes the HTML greater than (>) symbol.</li> 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=&quot;MyQueryField&quot; Location=&quot;Postback;QueryString(MyPostField)&quot; DefaultValue=&quot;0&quot;/>

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 .</li> 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=&quot;MyQueryField&quot; Location=&quot;Postback;QueryString(MyPostField)&quot; DefaultValue=&quot;0&quot;/>

Note The Name value must be the same as the Name value in the SQL clause. In this example, the Name value is .</li> Save the page as an .aspx file--for example, .</li> 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. The file name and the parameter will look similar to the following, where  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.</li> 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.</li> Change the view to Code view. To do this, click the Code tab in the lower part of your FrontPage 2003 window.</li>  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: <pre class="fixed_text"><form action=&quot;page2.aspx&quot; method=&quot;get&quot;> <select name=&quot;MyPostField&quot; size=&quot;1&quot;> 1 2  3  4  5 <input type=&quot;submit&quot;> </li> Save the page as an .aspx file--for example, .</li> <li>Start a Web browser program, such as Internet Explorer, and then open the page. In this example, the Web page file name is .</li></ol>

When you submit the form it will pass the parameter information to the query page.

Keywords: kbhowto kbinfo KB873014

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.