在我的页面中,有三个下拉菜单。
下拉列表1:在数据库(SQL)中存储从CarTab检索的car模型
下拉列表2:用于存储用户名
下拉式3:用于储存板号
所有下拉菜单的功能,都是相互关联的。让我们说,如果Admin选择本田Vios在下拉1,下降2将显示用户名,谁只预订了本田Vios之前。然后在下降3,它将显示车牌号码的汽车。例如,在CarTab,有6本田vios,当然,汽车有不同的车牌号码。对吗?因此,下降3,将显示给管理员的车牌号码选定的汽车。
管理员选择本田Vios在下拉1,下下降2将显示的用户名单谁选择本田vios和管理员选择用户A,车牌号码是SGH 12 is。然后,Admin点击“保存”按钮,将其保存到数据库中的新表中。
<td>Car Model</td>
<td class="style21">
<asp:DropDownList ID="DropDownList1" runat="server" Height="42px" Width="146px"
AutoPostBack="True">
<asp:ListItem>Please Choose</asp:ListItem>
<asp:ListItem>Honda Vios</asp:ListItem>
<asp:ListItem>Honda Civic</asp:ListItem>
<asp:ListItem>Honda City</asp:ListItem>
<asp:ListItem>Honda Jazz</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style18">
User</td>
<td class="style19">
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Username"
DataValueField="Username" Height="36px" Width="137px" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Connection %>"
SelectCommand="SELECT [Username] FROM [Rsvp] WHERE ([Model] = @Model)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="Model"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="style16">
Plate
</td>
<td class="style17">
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="SqlDataSource2" DataTextField="Plate" DataValueField="Plate"
Height="45px" Width="141px" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:Connection %>"
SelectCommand="SELECT [Plate] FROM [CarTab] WHERE ([Model] = @Model)">
</asp:SqlDataSource这里有个问题:
如何删除管理员选择的用户名和版本号?这意味着,当管理员登录时,本田vios列表和车牌号码的用户名将不再出现。我需要帮助。请引导我。
发布于 2012-09-11 12:50:42
您可以在数据库上创建一个查找表,以跟踪需要选择哪些项。然后向该表添加一个连接。就像这样:
SELECT [Username] FROM [Rsvp] join SelectedItems
on [Rsvp].ID = SelectedItems.ID
WHERE [Model] = @Model and SelectedItems.HasBeenSelected = Falsehttps://stackoverflow.com/questions/12369959
复制相似问题