c# - Validate TextBox for Existing data in SQL -


i trying validate inputs database. user should not able save same title twice.

i using code:

private bool exists() {     var entity = factory.definitions.calculationparameters.list();          // list() lists values of existing data.      if (aspvalidators.validatetextboxes(titletextbox)) //validates textbox string     {         return entity.where(item => item.title == titletextbox.text);     } } 

now @ item => ... part i'm getting error :

cannot implicitly convert type 'system.collections.generic.ienumerable' 'bool'.

i don't know do. please?

so problem of return type of code

private bool exists() 

you returning 'system.collections.generic.ienumerable not of bool type.

you can use way

return entity.any(item => item.title == titletextbox.text); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -