<html>
<head>
<title>SQL Demos: Using the WHERE ... IN Clause (Example 1)</title>
<link rel="stylesheet" href="/shared/netdemos.css">
</head>
<body>
<div class="header"><h2>SQL Demos: Using the <b>WHERE ... IN Clause</b> (Example 1)</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<center>
<form runat="server">
<p>Select Category: <asp:dropdownlist id="lstTypes" runat="server"
datasourceid="types" datatextfield="ProductType"
autopostback /></p>
<asp:datalist id="lstProducts" runat="server"
datasourceid="products" width=90% repeatcolumns=2>
<itemtemplate>
<table width=90% align="center" cellpadding=10>
<tr>
<td valign="top">
<img align="top" src='<%# Eval ( "ProductImageUrl" ) %>'
style="width:150; border-radius:10px; box-shadow:2px 2px 4px gray">
</td>
<td valign="top">
<b>Code:</b> <%# Eval ( "ProductCode" ) %><br>
<b>Name:</b> <%# Eval ( "ProductName" ) %><br>
<b>Description:</b> <%# Eval ( "ProductDescription" ) %><br>
<b>Price:</b> <%# Eval ( "UnitPrice", "$ {0}" ) %>
</td></tr>
</table>
</itemtemplate>
</asp:datalist>
<asp:accessdatasource id="types" runat="server"
datafile="~/app_data/dbtutor.mdb"
selectcommand="SELECT DISTINCT ProductType FROM Products WHERE ProductType IN ( 'Shirt', 'RockShoes', 'Supplies' )"
datasourcemode="DataReader" />
<asp:accessdatasource id="products" runat="server"
datafile="~/app_data/dbtutor.mdb"
selectcommand="SELECT ProductCode, ProductName, ProductDescription, UnitPrice, ProductImageUrl FROM Products WHERE ProductType=?">
<selectparameters>
<asp:controlparameter controlid="lstTypes"
propertyname="SelectedValue" />
</selectparameters>
</asp:accessdatasource>
</form>
</center>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>