Im trying to store some data in a neo4j db with the following (broken down query) wich works, not 100% proper but all data are send to my db:
var query2Neo = "CREATE (p:Person { samAccountName:'" + de.Properties["samAccountName"].Value + "'});
As my next step I try to write the label with real data not just person:
var query2Neo = "CREATE (p:'" + de.Properties["samAccountName"].Value + "' { samAccountName:'" + de.Properties["samAccountName"].Value + "'})";
thats not working, but should I think?
thank you
This just due to the single quote around the label.
Your code will generate a query like that CREATE (n:'Person' { ...})
and it's not valid.
You should use the backtick instead ( ` ) so it
CREATE (n:`Person` { ...})
So your code should be :
var query2Neo = "CREATE (p:`" + de.Properties["samAccountName"].Value + "` { samAccountName:'" + de.Properties["samAccountName"].Value + "'})";
Moreover, for your properties values, you should use query parameters instead of generating the cypher query in your code (but this not possible for label). It's possible to send map as a parameter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.