- DmProvider is an ADO.NET data provider for DaMeng(DM).
- 适用于达梦数据库的ADO.NET数据提供程序
// set these values correctly for your database server
// 根据实际情况设置参数的值
var builder = new DmConnectionStringBuilder
{
Server = "your-server",
Port = 5236,
Schema = "database-name",
User = "database-user",
Password = "P@ssw0rd!"
};
// open a connection
// 打开连接
using var connection = new DmConnection(builder.ConnectionString);
connection.Open();
// 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;";
command.Parameters.AddWithValue("@OrderId", orderId);
// execute the command and read the results
// 执行SQL命令并读取结果
using var reader = command.ExecuteReader();
while (reader.Read())
{
var id = reader.GetInt32("order_id");
var date = reader.GetDateTime("order_date");
// ...
}
The main types provided by this library are: 此程序库提供了这些主要类型:
DmConnection
(implementation ofDbConnection
)DmCommand
(implementation ofDbCommand
)DmDataReader
(implementation ofDbDataReader
)DmBulkCopy
DmConnectionStringBuilder
DmConnectorFactory
DmDataAdapter
(implementation ofDbDataAdapter
)DmException
DmTransaction
(implementation ofDbTransaction
)
- Entity Framework Core: dmdbms.Microsoft.EntityFrameworkCore.Dm