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
Post a Comment