1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Hyperlink on Name, use Name in an SQL statement when clicked

Discussion in 'C#' started by lespaul00, Jun 24, 2008.

  1. #1
    Hello,

    ASP.NET 2.0 and C#

    I have a page that uses an SQL statement to list a bunch of Names as such:

    Abby Harry Tom

    Lewis Gabriela Sam

    Chris Mike Larry


    Further down, I have another SQL query that pulls information for a specific person:

    SELECT * FROM TBLNAME WHERE NAME = "?????"



    So, this is what I'd like to do.

    1. First, create the name list into hyperlinks:

    Abby Harry Tom

    Lewis Gabriela Sam

    Chris Mike Larry



    2. Next, whenever one of the hyperlinks is clicked, that person's name goes into the SQL statement further down. For instance, if I click Abby (also, her name would bold to show it was selected),...

    Abby Harry Tom

    Lewis Gabriela Sam

    Chris Mike Larry



    SELECT * FROM TBLNAME WHERE NAME = "ABBY"



    I believe i'd need to set NAME = @NAME... and somehow link the hyperlinks to the @NAME parameter. But, i'm a beginner, and really have no clue. Any help is very much appreciated. Thanks!
     
    lespaul00, Jun 24, 2008 IP
  2. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #2
    There's a few ways to do this; can you post the code you have so far so we can review it and add to it?
     
    itcn, Jun 27, 2008 IP
  3. mohi.khan

    mohi.khan Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I am not sure what is your real scenerio is!! U can get some hints from below code. If still problem u can send me detail:

    <asp:HyperLinkField HeaderText="Name"
    DataTextField="Name" DataNavigateUrlFormatString="NameView.aspx?Code={0}"
    DataNavigateUrlFields="id" />

    Thnx...
     
    mohi.khan, Jun 27, 2008 IP