0

I'm working on a.NET 7.0 application that needs to query a PostgreSQL database using Apache Age. To connect to the database, I'm using the Npgsql package.

I've successfully connected to the database with Npgsql, but I'm not sure how to run an Age query and receive the results. I've gone over the documentation for both Npgsql and Apache Age, but I'm still unsure how to go ahead.

I have tried this

using Npgsql;

var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase"; using var conn = new NpgsqlConnection(connString); conn.Open();

var cmd = new NpgsqlCommand("MATCH (n)-[:LIKES]->(m) RETURN n.name, m.name", conn); var reader = cmd.ExecuteReader();

// What do I do next with the reader?

2 Answers 2

0

You can use this to retrieve th rows:

while (reader.Read()){
string name1 = reader.GetValue(0).ToString();
string name2 = reader.GetValue(1).ToString();
Console.WriteLine("{0} likes {1}", name1, name2);}
Sign up to request clarification or add additional context in comments.

Comments

0

I don't think so that there is any driver for .net framework in apache age so it is not possible to run age queries in your application. As per apache age github we can see in drivers folder that there are drivers for nodejs, python, golang but none for .net (c#).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.