locked
Select query inside dropdownlist to concatenate 2 columns -vb.net RRS feed

  • Question

  • User-1578974752 posted

    select ISO_CODE||'-'||SHORT_NAME  from country_master

    I want to show this inside the dropdownlist .When I test the query inside the dropdownlist ,it is showing as

    AUS-Australia   ( This is the one I was looking for)

    but when I run the form ,it is showing as system.data.datarowview in the dropdownlist. Appreciate the Help

    Tuesday, February 26, 2019 2:35 AM

Answers

  • User61956409 posted

    Hi shsu,

    when I run the form ,it is showing as system.data.datarowview in the dropdownlist. Appreciate the Help

    Please try to specify the DataValueField and DataTextField of your DropDownList control, like below.

    select ISO_CODE||'-'||SHORT_NAME as codewithname from country_master
    DropDownList1.DataSource = tb
    DropDownList1.DataValueField = "codewithname"
    DropDownList1.DataTextField = "codewithname"
    DropDownList1.DataBind()

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 26, 2019 5:46 AM

All replies

  • User409696431 posted

    Please provide more information.  What do you mean "showing a query inside a dropdownlist"?

    Please provide the code you are using.

    Tuesday, February 26, 2019 3:51 AM
  • User61956409 posted

    Hi shsu,

    when I run the form ,it is showing as system.data.datarowview in the dropdownlist. Appreciate the Help

    Please try to specify the DataValueField and DataTextField of your DropDownList control, like below.

    select ISO_CODE||'-'||SHORT_NAME as codewithname from country_master
    DropDownList1.DataSource = tb
    DropDownList1.DataValueField = "codewithname"
    DropDownList1.DataTextField = "codewithname"
    DropDownList1.DataBind()

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 26, 2019 5:46 AM