Home Forums SQL Server 2008 SQL Server 2008 - General Can dropdown (or multi-select) lists be populated with values from a database look-up? RE: Can dropdown (or multi-select) lists be populated with values from a database look-up?

  • Ed Wagner (2/5/2016)


    Sean Lange (2/5/2016)


    Stix83 (2/5/2016)


    I have a table that has fields Code and Description

    EG:

    Code | Description

    L40.2 | Sinusitis

    I want to know if I can do this with a trigger

    If I select the code, I want the description to auto populate in the next row beneath the code entry.

    Very new at this Trigger functionality but willing to learn

    No. That is not at all how triggers in sql work. A trigger fires when Update, Insert or Delete happens. They also cannot return data. What you need is an event in your application that fires on ValueChanged of your combobox and runs a query to get the new set of values for your application. This has nothing to do with triggers in sql server.

    Of, if you're using .NET, the SelectedIndexChanged event will be the one you want.

    Yeah that one. 😀 Not sure where I came up with ValueChanged. Sheesh!!! I have doing nothing but .NET for close to 15 years now.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/