Survey - implementing CRUD with "foreign name" instead of foreign key.

Discussion in 'ASP .Net' started by H5N1, May 4, 2006.

  1. H5N1

    H5N1 Guest

    hi all

    it's extremely common scenario, so I would like to ask you how do you
    usually implement CRUD functionality for following structure. Basically
    it's all about displaying "foreign name" (ie. some textual description)
    instead of foreign key.


    GUI:

    Table1ID
    Info1
    Table2.Name [Join on table2ID, DropDownList in Edit mode]


    Database:

    table1 table2
    ----------------- ------------------
    PK table1ID PK table2ID
    info1 Name
    FK table2ID

    this structure can describe for example some entity and it's category.


    I'm using .net 2.0 typed datasets with TableAdapter Wizard, and I think
    that, considering how ubiqitous is this structure, optimal solution
    should be simpler than mine:

    My way to do it:

    It uses 2 objectDataSources and 2 corresponding TableAdapters:

    ---- one for displaying table1 with table2.name instead of table2ID

    dataset uses JOIN on table2.id.

    the drawback is that TableAdapterWizard cannot automatically generate
    update/insert/delete statements. since it's multitable query


    --- second ODS and tableAdapter to feed DropDownList in DetailsView's
    edit mode
    (simple select table2ID,name from table2)

    dropdownlist works thanks to it's useful Text/Value parameters:
    DataSourceID="odsTable2"
    DataTextField="Name"
    DataValueField="CourseCategoryID"
    SelectedValue='<%# Bind("Table2ID", "{0}")




    So, there must be 2 dataSources, and 2 tableAdapters, including one
    with multiTable query which is a drawback in TAW.


    One simpler solution comes to my mind - using the same DDList in
    ItemTemplate as in EditItemTemplate, but then it has do be disabled
    (and hence greyed out) to disallow it's changing - isn't there any way
    to use a Label (or other read-only) control in such way (text/value)?


    thanks for thoughts
    H5N1, May 4, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattC

    CRUD in SP or Dynamic SQL

    MattC, May 24, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    602
    spinthemoose
    May 25, 2005
  2. =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?=

    Recommendation for CRUD functionality?

    =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?=, Dec 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Jon Paal
    Dec 15, 2005
  3. Lionel
    Replies:
    9
    Views:
    3,370
  4. M P
    Replies:
    1
    Views:
    455
  5. Victor Hooi
    Replies:
    1
    Views:
    102
    Victor Hooi
    Oct 29, 2013
Loading...

Share This Page