Skip to content

It's the foundation of DotNetCore.EntityFrameworkCore.GaussDB

License

Notifications You must be signed in to change notification settings

dotnetcore/DotNetCore.GaussDB

Repository files navigation

DotNetCore.GaussDB - the .NET data provider for PostgreSQL

Member project of .NET Core Community nuget stats

Quickstart

Here's a basic code snippet to get you started:

using GaussDB;

var connString = "host={host};port={port};username={username};password={password};database={database}";

var dataSourceBuilder = new GaussDBDataSourceBuilder(connString);
var dataSource = dataSourceBuilder.Build();

var conn = await dataSource.OpenConnectionAsync();

// Insert some data
await using (var cmd = new GaussDBCommand("INSERT INTO data (some_field) VALUES (@p)", conn))
{
    cmd.Parameters.AddWithValue("p", "Hello world");
    await cmd.ExecuteNonQueryAsync();
}

// Retrieve all rows
await using (var cmd = new GaussDBCommand("SELECT some_field FROM data", conn))
await using (var reader = await cmd.ExecuteReaderAsync())
{
    while (await reader.ReadAsync())
        Console.WriteLine(reader.GetString(0));
}

About

It's the foundation of DotNetCore.EntityFrameworkCore.GaussDB

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages