Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-29-2021 02:50 PM
I am new both to Neo4J and C#. I copied a simple HelloWorld example, but from what I can tell it doesn't even connect to the DB. Initially I tried with the correct username/pwd/port, but when I saw that the create statement doesn't seem to be executed I tried with the wrong pwd/port hoping to see a DB connect error that would at least confirm that with correct credentials it did connect, but I get no error with the wrong credentials, which is confusing. Neo4J is started and I can execute queries in the Neo4J Browser. Any help would be appreciated. The code is below. Thank you for your time.
public async Task CreateNode(){
Console.WriteLine("CreateNode");
//IDriver driver = GraphDatabase.Driver("neo4j://localhost:7687", AuthTokens.Basic("neo4j", "pwd"));
IDriver driver = GraphDatabase.Driver("bolt://localhost:7687", AuthTokens.Basic("neo4j", ""));
IAsyncSession session = driver.AsyncSession(o => o.WithDatabase("neo4j"));
try
{
Console.WriteLine("before run ");
IResultCursor cursor = await session.RunAsync("CREATE (person:Person {name: 'Fooo'})");
Console.WriteLine("after run");
await cursor.ConsumeAsync();
}
finally
{
await session.CloseAsync();
}
await driver.CloseAsync();
}
11-30-2021 12:05 AM
Hi @mmuslea,
welcome to the community!
Using C# I recommend working with Neo4jClient as it is much easier not only to connect but also to handle queries and results. GitHub - DotNet4Neo4j/Neo4jClient: .NET client binding for Neo4j
Best,
Reiner
11-30-2021 11:36 AM
Do you by any chance have any Neo4jClient basic code that I can start with, or a pointer to a "HellowWorld" Neo4jClient sample? Their documentation seems to be out of date for the current version of Neo4jClient and most of the sample code that I find is old and uses previous version.
Thank you for your help.
Maria
11-30-2021 08:25 AM
Thank you, I'll give this a try.
11-30-2021 10:55 PM
In this issue there is a sample Program.zip that might help: Http and Bolt clients serialize input parameters differently · Issue #419 · DotNet4Neo4j/Neo4jClient...
Best,
Reiner
12-01-2021 11:27 AM
Thank you, I appreciate it.
Maria
All the sessions of the conference are now available online