Last post Aug 11, 2014 10:09 AM by sandipnehate
Aug 09, 2014 02:56 AM|bhargavdudani|LINK
I am using petapoco as a my orm
i am searching for solution form last some days for result return by following kind of query
select max(hg_displayorder) from tbl_homegallery where hg_hmid=1
it will return any int or null as a result i want petapoco code to handle this value
Int64 disord=Connection.Single<Int64>("select max(hg_displayorder) from tbl_homegallery where hg_hmid=@0", 1);
i am using ablove at this time but it is fire a error when it have null value so any help to handle this case ?
Thanks in advance
Aug 10, 2014 02:49 AM|joeriks|LINK
Hi, single expects it to return one value, use ExecuteScalar instead
Aug 11, 2014 10:09 AM|sandipnehate|LINK
Use nullable types. I don't know about PetaPOCO whether it supports nullable values or not.
You can give a try.
Int64? disord=Connection.Single<Int64?>("select max(hg_displayorder) from tbl_homegallery where hg_hmid=@0", 1);