cancel
Showing results for 
Search instead for 
Did you mean: 

Different Results Using Parameters Versus Built String

as185386
Node

When running a query in .NET, I am getting different results if I use bound parameters versus if I simply replace the parameters in the string with the actual values. The query I am using is:

MATCH (e:Environment)-->(c:Company)-[o:Owns]->(g:LaneConfig)
WHERE e.name=$env AND c.companyNumber=$cid AND ID(g)=$configId
RETURN ID(g) as foundId
UNION
MATCH (e:Environment)-->(c:Company)-[o:Owns]->(g:LaneConfig)-[p:IsParent*1..99]->(x:LaneConfig)
WHERE e.name=$env AND c.companyNumber=$cid AND ID(x)=$configId
RETURN ID(x) as foundId

If I query a query using the following string it works as I would expect:

var s = cypher.Replace("$env", env).Replace("$cid", cid).Replace("$configId", configId);
var query = new Query(s);

However, if I create a query using parameters instead (as shown below), no records are returned:

var query = new Query(cypher, new { env, cid, configId });

I'm not understanding why I am getting different results. Thanks for all your help!!!

0 REPLIES 0