c# - Can't find parameter on querystring -


i have query string in parameter want between apostrophes :

select * mytable t t.name= ':name' 

however when debugging code tells me not find parameter :

protected bool validname(string n, nhibernate.isession sesion){   var result= sesion.createsqlquery(queries.getquery("queryname"))                 .setparameter("name", n)                 .uniqueresult(); 

the query parser should apply sql statements your. try doing query this:

select * mytable t t.name = :name 

i recommend using hql, sample:

var result = session.createquery("from entity t t.name = :name")                     .setparameter("name", n)                     .uniqueresult(); 

where entity entity references table (by mapping).


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -