0

In my page, there are 3 drop down menu.

Dropdown 1 : for storing car model which retrieved from CarTab in database (SQL)

Dropdown 2 : for storing username

Dropdown 3 : for storing plate num

The function of the all drop down menu, there are related to each other. Let says if Admin select Honda Vios in drop down 1, the drop down 2 will display usernames who only booked Honda Vios previously. Then in drop down 3, it will display the plate number of the car. For example, in the CarTab, there are 6 Honda vios and of course the cars have different plate number. Right? So, the drop down 3, will show to the Admin the plate number of the selected car.

Admin select Honda Vios in drop down 1, next drop down 2 will show list of users who selected Honda vios and the Admin select User A, and the plate number is SGH 12BC. Then Admin hit the save button and save it into new table in database.

<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

Here is the question:
how to remove the username and the plate number selected by Admin? Meaning, when Admin login, the username for Honda vios list and plate number will not appear again. I need help. Please guide me.

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by hollystyles
0

I think you are saying: "I want to select all users who are not already saved in the new table yet."

You need to make your SQL statement LEFT JOIN on the new "saved to" table that you mention, and only select records that don't have a matching record in the table your admin is saving his/her selections too.

SELECT [Username] FROM [Rsvp] LEFT JOIN [SavedTable] ON [Rsvp].[Username] = [SavedTable].[Username] WHERE ([Model] = @Model AND [SavedTable].[Username] IS NULL)

Edited by hollystyles

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.