none
Table Adapter - Computed Column calling external function RRS feed

  • Question

  • Hi,

    Is it possible to create a computed column in TableAdapater which gets its value from an external function.

    For example:
    Table Structure:
    EmployeeName NVARCHAR(50)
    EmployeeNumber INT
    EmployeeCode NVARCHAR(256)

    I want to create a computed column in Table Adapter which can call an external function CreateHash(EmployeeCode) and populate the computed column EmployeeHash NVARCHAR(64).

    When I set the Expression for the Computed column as CreateHash(EmployeeCode) - visual studio complains 'unknown function'.

    Thanks,
    Loonysan
    http://mystutter.blogspot.com


     
    Thanks, Loonysan | http://mystutter.blogspot.com
    Wednesday, February 11, 2009 5:10 PM

Answers

  • By default, you cannot use external functions in column expressions, so generated TableAdapter will not be able to use it. But since TableAdapter is a partial class, you can try to extend it implementing your own functionality in separate partial calls file (so it does not affect generated code) and use functions there.


    Val Mazur (MVP) http://www.xporttools.net
    Thursday, February 12, 2009 11:15 AM
    Moderator