How to solve the issue?
OR is there any other way to check if the result contains any records?(except rdr.Read() method)
btw I am using Sqlserver Compact 3.5
You say "except rdr.Read()
method" but that feels like the most natural approach to me.
Call Read()
, and if it returns true, populate the result, otherwise set the result to null.
Also note that
catch (Exception e)
{
throw;
}
is generally an abomination which should be removed. I would also question a design and implementation which:
getSites
)bool
return value but always returned true, and an out
parameter for the real resultsrdr
method way before it's needed, for no obvious reason. (It's not going to be useful outside the using
statement anyway, so why not declare it there?)