cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Different Results Using Parameters Versus Built String

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