Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Select actual name value instead of Identity Seed from a (FK) column?

vinsavantvinsavant Posts: 8Member
Situation: Have two tables created in MS SQL Server 2005

[b]Table1[/b]

CustomerID Integer PK
CustomerName Varchar
CustomerAddress Varchar
CountryID FK (from Country Table)

[b]Table2 [/b]

CountryID Integer PK
CountryName Varchar
CountryRegion FK (from Region Table)

Current Outcome:

I connected Table1 (this table was already populated with a few sample records) to Visual Studio.Net 2008 and placed this tables TextBoxControls on a Form for the purpose of DataEntry of new records and/or modification of existing records on the table. This part works as intended. I converted the CountryID field into a DropDownList in order to pick the appropriate country depending on the customer. This part is the problem. First of all, it only show one record available in this field, the seed value of the CountryID from the Table2 CountryID (example 1).

Desired Outcome:

What I need this field to do is to show me a list of

Comments

  • bradwangbradwang Posts: 197Member
    Set both DataValueField and DataTextField to CountryName for the dropdownlist before doing the data bind.

    Hope this will solve your problem. :)


    [color=Green][size=1][b]Brad Wang - .NET Freelancer from China
    MSN: brad_wang_cn@hotmail.com
    Skype: brad_wang[/b][/size][/color]
Sign In or Register to comment.