GeneralData.GBase8s.DataProvider is a .NET library based on ADO.NET for accessing GBase8s databases.
$ dotnet add package GeneralData.GBase8s.DataProviderGeneralData.GBase8s.DataProvider is a C# ADO.NET driver for GBase8s database.
// set these values correctly for your database server
GbsConnectionStringBuilder build = new GbsConnectionStringBuilder();
build.Host = "172.16.3.23";
build.Service = "9953";
build.Server = "rc53";
build.Database = "test";
build.UID = "root";
build.Pwd = "gbase@2025";
build.DbLocale = "zh_CN.utf8";
build.ClientLocale = "zh_CN.utf8";
// open a connection
var conn = $"{build.ConnectionString};";
var connection = new GbsConnection(conn);
// create a DB command and set the SQL statement with parameters
using var command = connection.CreateCommand();
command.CommandText = @"SELECT * FROM orders WHERE order_id = @OrderId;";
var param = new GbsParameter();
param.ParameterName = "OrderId";
param.GbsType = GbsType.Integer;
param.Value = 1;
command.Parameters.Add(param);
// execute the command and read the results
using var reader = command.ExecuteReader();
while (reader.Read())
{
var id = reader.GetInt32(0);
var date = reader.GetDateTime(1);
// ...
}
The main types provided by this library are:
GbsConnection (implementation of DbConnection)GbsCommand (implementation of DbCommand)GbsDataReader (implementation of DbDataReader)GbsConnectionStringBuilderGbsDataAdapterGbsExceptionGbsTransaction (implementation of DbTransaction)