Showing posts with label resultset. Show all posts
Showing posts with label resultset. Show all posts

Sunday, February 19, 2012

Filtering values in ResultSet by setting range on complex index

Hi!
I have table with complex index on 5 fields. One of them is string filed. I want to implement some sort of filtering, by setting SetRange() in my SQLCeCommand. But i need to fileter only by one string field and to get the values starting with the input string value.
I tried to use such code:
...
command.SetRange(DbRangeOptions.Prefix, new object[] {null, null, null, "Com", null}, null);
resultSet = cmd.ExecuteResultSet(ResultSetOptions.Scrollable);
....
But it doesn't work. As a result i've got an empty result set.
Usage of simple index on one field and setting the correspondent range will solve problem, but i can't have such index due to project restrictions.
Is there any way to set prefix range only by one value of complex index? If not, please, explain me how does Prefix Range works.

Thanx

If filtering has the same behavior as seeking (which I am assuming - read: not tested) then you might want to consider putting the column with the non-null value as the first in the index. This will require that you recreate the index with the new column order.

Filtering Single Recordset

Hello, I am a noob, so here goes. I would like to filter a resultset
returned from a stored procedure into 2 tables (e.g., summary section and
detail section). I would like to avoid 2 hits to the dB, so am returning a
summary and detailed resultset in 1 recordset. What I would like to do is
filter recordset 1 (say RectType = 1) into a summary table and filter
recordset 2 (say RectType = 2) into a detailed table. This has to be a
simple solution, but I must be missing something. Here's what I have tried
so far:
1) Adding filter on Details Grouping in the table - Nothing happens.
2) Adding filter in table Properties - Receive error: "An error has occurred
druing report processing. The processing of filter expression for table
'Summary' cannot be performed. The comparison failed. Please check the data
type returned by filter expression."
TIAI would think that you would need to do the filter on the table...but
that you are comparing two different data types. Try a convert to char
or a convert to int so that your data from the recordset and the data
in the filter are of the same type.|||OMG - I didn't even think of converting to char and that worked!!! Thanks a
bunch dude!
"Luke" wrote:
> I would think that you would need to do the filter on the table...but
> that you are comparing two different data types. Try a convert to char
> or a convert to int so that your data from the recordset and the data
> in the filter are of the same type.
>