in the line
RRSS.Open("select inventory_category from inventorycategory
where function_id = '" + a + "' and devicecategory = '" + b + "'",
CNN, 1, 2)
you are trying to add a string to the variable a - presumably a is a double, you should use & to concatenate and also convert the double to a string before concatenating.
try something like
RRSS.Open("select inventory_category from inventorycategory
where function_id = '" & a.ToString() & "' and devicecategory = '" & b.ToString() & "'",
CNN, 1, 2)
above code assumes b is also a numeric type.