c# - Separating data the right way -
let's imagine following scenario:
i've got table "types" , table "things". each "thing" has type defined via "things.typeid" column, has foreign key on "types.id" column.
now want access these types via c#-code, loads types list can use in application.
now let's think of method, tries load "things" have type "one" application.
select * things typeid = {0}"
where typeid type "one"? normally, enums suitable that, can't use enums since types stored in database , retrieved on runtime.
how can deal problem?
you can join
select things.* things join type on thing.typeid = type.typeid type.name = 'one' or when program starts load type dictionary typeid key , name value. bind dictionarylist combobox display value use key.
Comments
Post a Comment