sql - Get property that contains a given a value -
i wondering how better:
i using linq-to-sql retrieve data db. in db table called art, has few columns. 4 of columns called var1, var2, var3, var4 of type integer.
now question: when retrieve article need of vars equal given number. never same number twice in 4 fields in article, maybe other fields, need "limit" search 4 fields/properties.
now doing this:
public function getarticlerangeindex(article art) integer if article.var1 = 83 return 1 elseif article.var2 = 83 return 2 elseif article.var3 = 83 return 3 elseif article.var4 = 83 return 4 else throw new keynotfoundexception("variantnotfound") end if end function
is there better way? maybe @ time of retrieving data? approach looks bit "spartan" in opinion.
in example i've hard-coded number, read config-file or passed parameter, still thinking better.
Comments
Post a Comment