SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2003
    Location
    uk
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to query the code and name in asp.net

    Hi,

    Using asp.net, I have a dropdownlist with list of destinations. these are used to send a query to a mysql database. However, I was informed that other data will have destination codes instead of the actual destination name, so for instance, the column for destination in the database will have records with the name Manchester while others will have the code MAN. So at the moment, I have a limitation in the the asp.net form - I can only query the destination name so records with the code will not be resturned. below in the form and as you can see, it only has the name.

    Is there a way in the form to make it query both the name and the code? without changing the database and also using the dropdown list


    <aspropDownList id="departurepoint" runat="server">
    <asp:ListItem Selected="True">Select a Destination</asp:ListItem>
    <asp:ListItem>London</asp:ListItem>
    <asp:ListItem>Manchester</asp:ListItem>
    <asp:ListItem>Belfast</asp:ListItem>
    <asp:ListItem>Birmingham</asp:ListItem>


    Thanks in advance

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,878
    Mentioned
    47 Post(s)
    Tagged
    0 Thread(s)
    Well, that is rather bad database design, and you are going to end up shooting yourself in the foot. You are going to have to map each name to a code. If is Manchester is selected search for Manchester or MAN. But you are going have to do this for each item. Are you value can be MAN,Manchester, then you split on , and you will have both. But that is not great and in the end it would be best to fix the database accordingly.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may be able to create a table that holds a list of destinations and their codes, I am presuming they are airport codes. In the table list the name and it's code, I believe you can then map these to a drop down list. In normal HTML the value sent by the form and the description of the selected item can be different, I am assuming this can also be done with an asp.net drop down as well.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •