jagid wrote:
Note that technique that I suggested above does not work with all databases. It does work with SQL Server but it did not work for SQL Anywhere 10 (I wrote a custom Driver - I'll contribute it to the project). The workaround was to use a combination of my approach and the suggestion made by IndrajeetP:
Code:
ISQLQuery q = _session.CreateSQLQuery("DELETE FROM t1 select 1 IgnoreMe");
q.AddScalar("IgnoreMe", NHibernateUtil.Int32);
q.UniqueResult();
Of course it would be wonderful if ISQLQuery contained an Execute() / NoResult() method. If other people think that this would be useful then I can look into adding this.
Hi, I m trying to execute Select statment like
ISQLQuery sql = _session.CreateSQLQuery("select count(*) from PD4Log");
sql.AddScalar("xyz", NHibernateUtil.Int32);
string _results = sql.SetFirstResult(0).UniqueResult().ToString();
and it show the following error
System.IndexOutOfRangeException
Please reply how to execute any select stament and get the result in Nhibernate.
Thanks
Mukesh
mukesh.usts@gmail.com